Electrical Connections¶
Python Code¶
In [1]:
import box0
import time
# open the device (Box0 USB open a supported device)
dev = box0.usb.open_supported()
# open DIO (digital Input/Output) module
dio = dev.dio()
dio.basic_prepare()
# initalize the pin
pin0 = dio.pin(0)
pin0.output()
pin0.low()
pin0.enable()
dio.basic_start()
try:
# perform a loop and toggle the pin 2 times per second
while True:
pin0.toggle()
time.sleep(.5)
except KeyboardInterrupt:
# user want to exit
pass
dio.basic_close()
# close the resources
dio.close()
dev.close()