LEDE on Linkit 7688 Duo – Firmata and Python

After the python test in the previous article

LEDE on Linkit 7688 Duo – MPU-MCU Uart communication

here we describe how to do the same operation using the Firmata  python library

Firmata Protocol

In this case, the programming model is the following

duo-firmata-archAs first step,  described in the Mediatek article

Using Firmata with Python

we install the Firmata python library; in a linux terminal on LEDE run

In the Arduino IDE choose File->Examples->Firmata->StandardFirmata

arduinofirmataMake the following change in sketch code:

Look for the code

Firmata.begin(57600);
  while (!Serial) {

and replace it with

  Serial1.begin(57600);
  Firmata.begin(Serial1);
 
  while (!Serial1) {

Save the file and perform the compilation and upload on the Linkit 7688 Duo.

In a linux terminal  in Lede create the blink_with_firmata.py file and copy the following code inside

Save and quit.

Always in a linux terminal run now

The LED on the card should turn on and off.

Below is the link to download the two files  ready for the Link 7688 Duo

 Lede Python Firmata files

In the next article we’ll enable the board to work like Arduino Yun

LEDE on Linkit 7688 Duo – Timecheck example