Example #1
0
#!/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
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
Example #3
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: '
    print 'Channel 1: ' + str(adc.read_adc_voltage(1, 0))
    print 'Channel 2: ' + str(adc.read_adc_voltage(2, 0))
    print 'Channel 3: ' + str(adc.read_adc_voltage(3, 0))
    print 'Channel 4: ' + str(adc.read_adc_voltage(4, 0))
    print 'Channel 5: ' + str(adc.read_adc_voltage(5, 0))
    print 'Channel 6: ' + str(adc.read_adc_voltage(6, 0))
    print 'Channel 7: ' + str(adc.read_adc_voltage(7, 0))
    print 'Channel 8: ' + str(adc.read_adc_voltage(8, 0))
    print ''
    print 'IO: '
    print 'Pin 1: ' + str(io.read_pin(1))
    print 'Pin 2: ' + str(io.read_pin(2))
    print 'Pin 3: ' + str(io.read_pin(3))
Example #4
0
# 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: ')
    print('Channel 1: ' + str(adc.read_adc_voltage(1)))
    print('Channel 2: ' + str(adc.read_adc_voltage(2)))
    print('Channel 3: ' + str(adc.read_adc_voltage(3)))
    print('Channel 4: ' + str(adc.read_adc_voltage(4)))
    print('Channel 5: ' + str(adc.read_adc_voltage(5)))
    print('Channel 6: ' + str(adc.read_adc_voltage(6)))
    print('Channel 7: ' + str(adc.read_adc_voltage(7)))
    print('Channel 8: ' + str(adc.read_adc_voltage(8)))
    print('')
    print('IO: ')
    print('Pin 1: ' + str(io.read_pin(1)))
    print('Pin 2: ' + str(io.read_pin(2)))
    print('Pin 3: ' + str(io.read_pin(3)))
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
#!/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
# 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: ')
    print ('Channel 1: ' + str(adc.read_adc_voltage(1)))
    print ('Channel 2: ' + str(adc.read_adc_voltage(2)))
    print ('Channel 3: ' + str(adc.read_adc_voltage(3)))
    print ('Channel 4: ' + str(adc.read_adc_voltage(4)))
    print ('Channel 5: ' + str(adc.read_adc_voltage(5)))
    print ('Channel 6: ' + str(adc.read_adc_voltage(6)))
    print ('Channel 7: ' + str(adc.read_adc_voltage(7)))
    print ('Channel 8: ' + str(adc.read_adc_voltage(8)))
    print ('')
    print ('IO: ')
    print ('Pin 1: ' + str(io.read_pin(1)))
    print ('Pin 2: ' + str(io.read_pin(2)))
    print ('Pin 3: ' + str(io.read_pin(3)))
# 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: '
    print 'Channel 1: ' + str(adc.read_adc_voltage(1))
    print 'Channel 2: ' + str(adc.read_adc_voltage(2))
    print 'Channel 3: ' + str(adc.read_adc_voltage(3))
    print 'Channel 4: ' + str(adc.read_adc_voltage(4))
    print 'Channel 5: ' + str(adc.read_adc_voltage(5))
    print 'Channel 6: ' + str(adc.read_adc_voltage(6))
    print 'Channel 7: ' + str(adc.read_adc_voltage(7))
    print 'Channel 8: ' + str(adc.read_adc_voltage(8))
    print ''
    print 'IO: '
    print 'Pin 1: ' + str(io.read_pin(1))
    print 'Pin 2: ' + str(io.read_pin(2))
    print 'Pin 3: ' + str(io.read_pin(3))