Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
languagepy
linenumberstrue
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
languagepy
linenumberstrue
pycom.heartbeat(False)


We then deactive the heartbeat funcionality.

Code Block
languagepy
linenumberstrue
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
languagepy
linenumberstrue
	pycom.rgbled(0x007f00) # green
    time.sleep(5)

...