After the building and installion of the LEDE firmware on the Linkit 7688 Duo card
Installation and configuration of Lede image on Linkit 7688 Duo
let’s test the functionality of some features on the card.
You can find the Mediatek article with the programming model
As a first example we treat the one on the Mediatek site as described in the title of the article
Linkit 7688 DUo MPU-MCU Uart Connection
which corresponds to the following programming model
As first step, Arduino IDE is configured as described in the link
Arduino IDE for Linkit 7688 Duo
the following code is uploaded on the Linkit 7688 Duo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
void setup() { Serial.begin(115200); // open serial connection to USB Serial port (connected to your computer) Serial1.begin(57600); // open internal serial connection to MT7688AN // in MT7688AN, this maps to device pinMode(13, OUTPUT); } void loop() { int c = Serial1.read(); // read from MT7688AN if (c != -1) { switch(c) { case '0': // turn off D13 when receiving "0" digitalWrite(13, 0); break; case '1': // turn off D13 when receiving "1" digitalWrite(13, 1); break; } } } |
This code manages the LED by the MCU according to the commands that the MCU receives at the Serial1 port.
Logic is handled instedad by python code that runs on Linux; create a file for this purpose, such as blink.py in a linux command shell on the board, with the following code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import serial import time s = None def setup(): global s # open serial COM port to /dev/ttyS0, which maps to UART0(D0/D1) # the baudrate is set to 57600 and should be the same as the one # specified in the Arduino sketch uploaded to ATmega32U4. s = serial.Serial("/dev/ttyS0", 57600) def loop(): # send "1" to the Arduino sketch on ATmega32U4. # the sketch will turn on the LED attached to D13 on the board s.write("1") time.sleep(1) # send "0" to the sketch to turn off the LED s.write("0") time.sleep(1) if __name__ == '__main__': setup() while True: loop() |
Running the code
1 |
python ./blink.py |
the LED on the card should turn on and off continuously.
In the next example we’ll use the Firmata python library to perform the same operation
LEDE on Linkit 7688 Duo – Firmata and Python