Skip to content

Latest commit

 

History

History
91 lines (47 loc) · 4.19 KB

File metadata and controls

91 lines (47 loc) · 4.19 KB

Example 1: Blinking LED

This example is inspired by the post "easy GUI front ends for Arduino Raspberry pi, and more with MyOpenLab" by Al Williams (Twitter, LinkedIn) published on hackaday.com. In this example you will build a bench tool by creating a "VirtualMachine (VM)" (i.e., virtual interfaces in MyLibreLab/MyOpenLab lingo). The VM will use your computer as a control panel and readout, and the electronic hardware as the physical interface. The MyLibreLab VM consists of two parts, like LabVIEW programs, a front end panel GUI and a block diagram program. some components of the block diagram will be also on the front panel such as switches, LEDs. While, some components only live on the block diagram side of the VM. On the block diagram panel you can connect components together to implement a computational algorithm or represent signal flow to physical systems such as Arduino and Raspberry Pi I/O.

ex001 pic001

To follow along this tutorial you need the hardware mentioned in this arduino.cc tutorial and a USB connection to the computer. Alternatively If you don’t have access to the actual hardware you may use software Like SimulIDE and KTechLab to emulate the hardware and have virtual serial ports. (#todo)

Installing Firmata:

Firmata library provides a standard protocol for serial communication and control of an Arduino expansion board. Connect the Arduino Uno board to the computer via USB cable, and open the Arduino IDE. Make sure you have the right port and board selected from the Menu bar > Tools:

ex001 pic003

Select the standardFirmata sketch from Menu bar > File > Examples > Firmata > StandardFirmata

ex001 pic004

and add the line below as the first line of the setup function:

analogReference(INTERNAL);

or alternatively upload the standardFirmata/StandardFirmata.ino sketch in this tutorial to the Arduino board.

ex001 pic005

To test that everything is working properly, open the Menu bar > Tools > Serial Monitor

ex001 pic006

and make sure the Baud rate of 57600 is selected at the bottom right corner

ex001 pic007

you should see the above message in the terminal.

Creating the MyLibreLab project:

Open the MyLibreLab software and create a new project from the toolbar or the menu bar (Alt⌥+a).

ex001 pic002

by specifying the Project Name, Project Location, and name of the Main VM and select OK:

ex001 pic008

then from the menu bar select the Interfaces:

ex001 pic009

and consequently select the Arduino Standard Firmata Interface …​

ex001 pic010

and place it on the Circuit Panel:

ex001 pic011

while the Firmata block is selected, on the Property-Editor panel, choose the right COM Port:

ex001 pic012

and then select the …​ on the Config Pins row.

ex001 pic013

activate Pin 2 as DIGITAL_INPUT and Pin 13 as DIGITAL_OUTPUT. Go to the Front panel and then select the Boolean:

ex001 pic014

put an Tilt button and LED red on the Front Panel:

ex001 pic015

now go back to the Circuit panel and connect the switch to Pin 2 and the Pin 13 to the LED

ex001 pic016

and then run:

ex001 pic017