Getting started with UPER on linux
Connecting
- Open up a terminal and enter
ls /dev/ttyACM*
. - Connect the UPER board to your linux machine using USB cable.
- Type
ls /dev/ttyACM*
again and you should see two new entries. Most often it will be /dev/ttyACM0 and /dev/ttyACM1. In any case, the device with the lower index should be UPER Command port, and the other - UART bridge (USB COM port adapter). - If you can't see new devices, that means you need to install USB CDC ACM drivers into your system and try again. The installation procedure is distribution dependent, so it will not be covered in here, but if you are having trouble doing it - feel free to contact us and we will be more than happy to help.
Blinking the LED
The easiest way to start working with UPER is by using UPER Python API, which is a part of IoTPy.
First of all if you haven't already done this, download and install Python 1).
Then download IoTPy API and save it in the directory in which you are going to work.
Next, in the same directory in which you extracted the IoTPy API create a blinky.py file and save the following code:
from time import sleep from IoTPy.pyuper.ioboard import IoBoard from IoTPy.pyuper.gpio import GPIO with IoBoard() as uper, uper.get_pin(GPIO, 27) as red_led: while True: print "LED ON" red_led.write(0) sleep(0.5) print "LED OFF" red_led.write(1) sleep(0.5)
Finally you can launch your program by executing python blinky.py
command.
1)
It is recommended that you use Python v2.7 as other versions were not extensively tested. If you are using other version and start experiencing problems with IoTPy one of the first things you should try is to switch to Python v2.7 and check if the problems persist.