import myRIO_API_client as myAPIc
from time import sleep

myRIO = myAPIc.MyRIO_API_Client()
# myRIO = MyRIO_API_Client(ip_address='172.22.11.3',port:8080)

print('Accelerometer:')
print(myRIO.get_onboard_accelerometer())
print('Onboard button:')
print(myRIO.get_onboard_button())
print('Digital Input 3:')
print(myRIO.get_digital_input(3))
print('Digital Input 0 (port B):')
print(myRIO.get_digital_input(3,port_in='B'))
print('Analog Input 1:')
print(myRIO.get_analog_input(1))
print('Onboard LEDS (all ON)')
print(myRIO.set_onboard_leds(15))
sleep(1)
print('Onboard LEDS (all OFF)')
print(myRIO.set_onboard_leds(0))
sleep(1)
print('Digital Output 0 ON')
print(myRIO.set_digital_output(0,1))
sleep(1)
print('Digital Output 0 OFF')
print(myRIO.set_digital_output(0,0))
sleep(1)
print('Analog Output 0 5.0V')
myRIO.set_analog_output(0,5.0)
print('Analog Input 2: (the same if wired)')
print(myRIO.get_analog_input(2))
sleep(1)
print('Analog Output 0 0.0V')
myRIO.set_analog_output(0,0.0)
print('Analog Input 2: (the same if wired)')
print(myRIO.get_analog_input(2))