Analog

Python Library for TI ADS1018 ADC.

Python Library

Turta_Analog library is responsible for reading analog inputs from the analog ports.

Initialization

Add the following statement to the top of your Python code.

from turta_protohat import Turta_Analog

Then, create an instance of the ADC class.

analog = Turta_Analog.ADC()

Now you're ready to access the library by calling its instance.

Basic Members

Read Analog Input

Reads the analog value.

read(ch)
  • Parameters

    • CH ch: Analog input channel.

  • Returns

    • Int: Analog readout.

Read Temperature

Reads the internal IC temperature.

read_temperature(fahrenheit)
  • Parameters

    • Bool fahrenheit: True for Fahrenheit output, False for Celcius output. (False is default.)

  • Returns

    • Float: Internal IC temperature.

Advanced Members

Config

Configures the device.

config(ch, pga, mode, dr, ts_mode)
  • Parameters

    • CH ch: Input channel. (Input multiplexer configuration.)

    • PGA pga: Programmable gain amplifier configuration.

    • MODE mode: Device operating mode.

    • DR dr: Data rate.

    • TS_MODE ts_mode: Temperature sensor mode.

  • Returns

    • None

Finalizer

When exiting from the program, the library releases the SPI bus.

Last updated