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)')
myRIO.set_onboard_leds(15)
sleep(1)
print('Onboard LEDS (all OFF)')
myRIO.set_onboard_leds(0)
sleep(1)
print('Digital Output 0 ON')
myRIO.set_digital_output(0,1)
sleep(1)
print('Digital Output 0 OFF')
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))
print('MXP temperature')
print(myRIO.get_mxp_temperature())
print('MXP luminosity')
print(myRIO.get_mxp_luminosity())
print('MXP buttons')
print(myRIO.get_mxp_button(1))
print(myRIO.get_mxp_button(2))
print('MXP RGB LED set GREEN')
myRIO.set_mxp_rgb_color(1)
sleep(1)
print('MXP RGB LED set RED')
myRIO.set_mxp_rgb_color(2)
sleep(1)
print('MXP RGB LED set BLUE')
myRIO.set_mxp_rgb_color(4)
sleep(1)
print('MXP RGB LED set WHITE')
myRIO.set_mxp_rgb_color(7)
sleep(1)
print('MXP RGB LED set OFF')
myRIO.set_mxp_rgb_color(0)
