Created by Franck Albinet with source available here. Also presented by NSRC at APRICOT 2018.
Introduction
In this example, we will create and deploy the proverbial 1st app, “Hello, world!” to a Pycom device. Because the board does not have a display, we will use the USB connection between the board and the development PC to switch on and off an LED. In the simplest terms, a Light-Emitting Diode (LED) is a semiconductor device that emits light when an electric current is passed through it. LEDs are described as solid-state devices. The term solid-state lighting distinguishes this lighting technology from other sources that use heated filaments (incandescent and tungsten halogen lamps) or gas discharge (fluorescent lamps). Different semiconductor materials produce different colors of light.
...
Let's analyze the code:
Code Block | ||||
---|---|---|---|---|
| ||||
import pycom import time |
We first import two libraries: pycom and time. The pycom one includes the utilities necessary to operate the specific pycom hardware. The time one is used to keep track of time and helps operate the internal clock.
Code Block | ||||
---|---|---|---|---|
| ||||
pycom.heartbeat(False) |
We then deactive the heartbeat funcionality.
Code Block | ||||
---|---|---|---|---|
| ||||
for cycles in range(10): # stop after 10 cycles |
...
Indentation is very important in python! Make sure you indent the code after the
for
command.
Code Block | ||||
---|---|---|---|---|
| ||||
pycom.rgbled(0x007f00) # green time.sleep(5) |
...