# Created by Jose Humberto Garza Rosado from Spark_ADC import Adc ain0_operational_status = 0b0 ain0_input_multiplexer_configuration = 0b100 ain0_programmable_gain_amplifier_configuration = 0b010 ain0_device_operating_mode = 0b0 ain0_data_rate = 0b100 ain0_comparator_mode = 0b0 ain0_compulator_polarity = 0b0 ain0_latching_comparator = 0b0 ain0_comparator_queue_and_disable = 0b11 pt1 = Adc() pt1.set_config_command( ain0_operational_status, ain0_input_multiplexer_configuration, ain0_programmable_gain_amplifier_configuration, ain0_device_operating_mode, ain0_data_rate, ain0_comparator_mode, ain0_compulator_polarity, ain0_latching_comparator, ain0_comparator_queue_and_disable ) print hex(pt1.command) while True: print pt1.adc_read()
import mraa import logging ain0_operational_status = 0b0 ain0_input_multiplexer_configuration = 0b111 ain0_programmable_gain_amplifier_configuration = 0b001 ain0_device_operating_mode = 0b0 ain0_data_rate = 0b100 ain0_comparator_mode = 0b0 ain0_compulator_polarity = 0b0 ain0_latching_comparator = 0b0 ain0_comparator_queue_and_disable = 0b11 pin_GPLOW13 = 14 pt1 = Adc(address=0x48) pt1.set_config_command( ain0_operational_status, ain0_input_multiplexer_configuration, ain0_programmable_gain_amplifier_configuration, ain0_device_operating_mode, ain0_data_rate, ain0_comparator_mode, ain0_compulator_polarity, ain0_latching_comparator, ain0_comparator_queue_and_disable) def send_mail(): import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText fromaddr = "*****@*****.**" toaddr = "*****@*****.**" msg = MIMEMultipart()
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Created by Jose Humberto Garza Rosado from Spark_ADC import Adc operational_status = 0b0 input_multiplexer_configuration = 0b100 programmable_gain_amplifier_configuration = 0b010 device_operating_mode = 0b0 data_rate = 0b100 comparator_mode = 0b0 compulator_polarity = 0b0 latching_comparator = 0b0 comparator_queue_and_disable = 0b11 pt1 = Adc() pt1.set_config_command( operational_status, input_multiplexer_configuration, programmable_gain_amplifier_configuration, device_operating_mode, data_rate, comparator_mode, compulator_polarity, latching_comparator, comparator_queue_and_disable ) print hex(pt1.command)