#!/usr/bin/python from ABE_ExpanderPi import RTC from ABE_helpers import ABEHelpers import time """ ================================================ ABElectronics Expander Pi | Set Time Demo Version 1.0 Created 21/08/2014 run with: python demo-rtcset_date.py =============================================== This demo shows how to set the time on the Expander Pi real-time clock and then read the current time at 1 second intervals """ i2c_helper = ABEHelpers() bus = i2c_helper.get_smbus() rtc = RTC(bus) # create a new instance of the RTC class # set the date using ISO 8601 format - YYYY-MM-DDTHH:MM:SS rtc.set_date("2013-04-23T12:32:11") while True: # read the date from the RTC in ISO 8601 format and print it to the screen print rtc.read_date() time.sleep(1) # wait 1 second
# ABElectronics Expander Pi | Tester # Version 1.0 Created 08/11/2014 # Version 1.1 Updated 11/06/2017 updated to include changes to Expander Pi library # # run with: python tester.py # ================================================ # This script tests the various functionality of the Expander Pi rtc = RTC() # create a new instance of the RTC class adc = ADC() # create an instance of the ADC class io = IO() # create an instance of the IO class dac = DAC(1) # create an instance of the DAC class with a gain of 0 # set the date using ISO 8601 format - YYYY-MM-DDTHH:MM:SS rtc.set_date("2017-01-01T00:00:00") dac.set_dac_voltage(1, 1.5) # set the voltage on channel 1 to 1.5V dac.set_dac_voltage(2, 1.0) # set the voltage on channel 2 to 1.0V # set the reference voltage. this should be set to the exact voltage # measured on the Expander Pi Vref pin. adc.set_adc_refvoltage(4.096) while True: # clear the console os.system('clear') # read the date from the RTC in ISO 8601 format and print it to the screen print 'Date: ' + rtc.read_date() print '' print 'ADC: '
#!/usr/bin/python3 from ABE_ExpanderPi import RTC import time """ ================================================ ABElectronics Expander Pi | Set Time Demo Version 1.0 Created 21/08/2014 Version 1.1 Updated 11/06/2017 updated to include changes to Expander Pi library run with: python3 demo-rtcset_date.py =============================================== This demo shows how to set the time on the Expander Pi real-time clock and then read the current time at 1 second intervals """ rtc = RTC() # create a new instance of the RTC class # set the date using ISO 8601 format - YYYY-MM-DDTHH:MM:SS rtc.set_date("2017-06-11T12:32:11") while True: # read the date from the RTC in ISO 8601 format and print it to the screen print (rtc.read_date()) time.sleep(1) # wait 1 second
from ABE_ExpanderPi import RTC from ABE_helpers import ABEHelpers import time """ ================================================ ABElectronics Expander Pi | Set Time Demo Version 1.0 Created 29/03/2015 run with: python3 demo-rtcset_date.py =============================================== This demo shows how to set the time on the Expander Pi real-time clock and then read the current time at 1 second intervals """ i2c_helper = ABEHelpers() bus = i2c_helper.get_smbus() rtc = RTC(bus) # create a new instance of the RTC class # set the date using ISO 8601 format - YYYY-MM-DDTHH:MM:SS rtc.set_date("2013-04-23T12:32:11") while True: # read the date from the RTC in ISO 8601 format and print it to the screen print (rtc.read_date()) time.sleep(1) # wait 1 second
# Version 1.0 Created 29/03/2015 # # run with: python3 tester.py # ================================================ # This script tests the various functionality of the Expander Pi i2c_helper = ABEHelpers() bus = i2c_helper.get_smbus() rtc = RTC(bus) # create a new instance of the RTC class adc = ADC() # create an instance of the ADC class io = IO(bus) # create an instance of the IO class dac = DAC() # create an instance of the DAC class # set the date using ISO 8601 format - YYYY-MM-DDTHH:MM:SS rtc.set_date("2014-01-01T00:00:00") dac.set_dac_voltage(1, 1.5) # set the voltage on channel 1 to 1.5V dac.set_dac_voltage(2, 1.0) # set the voltage on channel 2 to 1.0V # set the reference voltage. this should be set to the exact voltage # measured on the Expander Pi Vref pin. adc.set_adc_refvoltage(4.096) while True: # clear the console os.system('clear') # read the date from the RTC in ISO 8601 format and print it to the screen print ('Date: ' + rtc.read_date()) print ('') print ('ADC: ')