Before Beginning
Before starting this project, you’ll need:
Callisto or another microMighty platform board
Micro-USB Cable
A Windows, MAC, or Linux computer
Overview
Welcome to the world of embedded programming using the Lua language and the E2FL/Callisto processor module. Using Callisto to learn to build embedded applications such as robots is quick, intuitive and fun. The only things that you’ll need to get going right away is an interest in some curiosity, and a serial terminal application. In the next few steps you’re going to connect Callisto to the computer, and test it by writing some quick code to light some LEDs!
Part 1: Setting Up CoolTerm
Installation
First thing, make sure that the CoolTerm app is installed on your computer. CooTerm is available for free from http://freeware.the-meiers.org/ and works with Windows, MAC nd Linux. Follow the installation directions once the app has downloaded and you’re ready to go.
Special Note to Windows Users: You may require a driver to be used in order for Windows to understand how to interface with the Callisto USB port. This driver can be downloaded from ST Microelectronics at the following web address.
Just download the driver and install the package from the installer.
Set Terminal Options
Once installed, run the CoolTerm app, and select the “Options” button from the toolbar ribbon to open the options dialog box.
On the options dialog, select “Terminal” from the list on the left to modify the terminal options. Then make sure that the Enter Key Emulation dropdown control is set to CR. Next, make sure that the FIlter ASCII Escape Sequences and the Handle BS and DEL characters are both CHECKED.
Select Port
Next, select the “Serial Port” line in the list on the left of the dialog to select the serial port to be used. Connect Callisto to the computer, and once connected, click the Re-Scan Serial Ports button. Then select the device for Callisto from the Port dropdown list.
Mac Users: Callisto is usually identified as “USB Modem”
Windows Users: Callisto will be enumerated as a “COM” device. Additionally, when connecting the board Windows may require the selection of a specific driver to use for Callisto. In that instance, select the ST driver that was installed from the link above.
Part 2: Testing The Setup
Making the Connection
When the setup is complete, the connection can be tested to verify that Callisto and the computer are talking. Click OK on the configuration dialog to accept the changes from above. Click the “Connect” button from the toolbar to open a connection to Callisto. You may notice that once the connection is made there is no fanfare, no confetti, and no output in the terminal, so to identify that the connection is working properly, type a letter and press the “Enter” key. The letter that was typed should appear along with nil and the prompt “[1]: “. This is indicating that Callisto is ready to accept code to execute.
Running Your First Code
At the “[1]: “ prompt, code can now be entered to check the operation of Callisto, a verify the connection with the host computer. To get a very quick introduction to Lua and Callisto, enter the code (in blue) below and hit the enter key.
This command turns on the BLUE LED that is integrated into Callisto. There are also green and yellow LEDs that are integrated into Callisto. Can you guess at how to turn on the green and yellow LEDs?
You guessed it, use the yellow:set() function to turn on the yellow LED, and green:set() function to turn on the green LED.
Turn off the LEDs
Can you turn off the LEDs? When working with signals engineers often refer to turning on a signal as setting it, and turning it off they clear it. When “on” a signal is also called active, and “off” signals are inactive.
Blink the LEDs
To blink an LED, the set() and clear() functions can be used to turn on an LED and then turn it off again, however, there is a repetitive portion to keep it going. Typing in set and clear function calls once isn’t bad, but what if we wanted the LED to blink every second for a half hour?!? For this quick check we’re going to use a loop structure to blink the LED until power is removed from Callisto. And, to save some more typing we’re going to use the pulse() function to turn the led on for a specific amount of time (in seconds)
After entering the statement until false the small program will begin executing and blink the LED on for 1 second and off for 0.5 seconds.
Exercises
Modify the blink program to change the length of time the LED is on.
Modify the blink program to blink more than one LED.
Write a loop that turns on each LED for 1 second.
Write a loop that turns off each LED for 1 second.