EL Sequencer/Escudo Dos Hookup Guide
Arduino Example Code
Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you are unsure about installing the FTDI drivers, please check out our tutorial on How to Install FTDI Drivers.
Once you have all of your hardware hooked up properly, it's time to program your Sequencer to run the EL Wire display as you want. You can download the most up-to-date code from the EL Sequencer GitHub repository. Or you can download the Arduino code in order to follow along with the example. We will be working with the "SparkFun_EL_Example.ino" example.
Board Selection
**If using the EL Sequencer: **
Plug in your FTDI board to the computer via USB, and insert the FTDI onto the EL Sequencer. Make sure you match up the BLK
to BLK
and GRN
to GRN
labels.
When uploading your code, please be sure to select the following settings in the IDE:
- Board: LilyPad Arduino
- Processor: ATMega328
- COM port: Whichever port the FTDI Basic appears on for your operating system.
**If using the EL Escudo Dos + RedBoard: **
Plug in the RedBoard to the computer via USB. Select the following settings in the IDE:
- Board: Arduino Uno
- COM port: Whichever port the FTDI Basic appears on for your operating system.
Demo Example Code
This basic demo will cycle through each channel on the Sequencer, one by one, repeating until the system is either reprogrammed or turned off.
In the first section, we must define each pin that we will be using on the ATMega328.
language:c
/*******************Setup Loop***************************/
void setup() {
// The EL channels are on pins 2 through 9 on the ATMega328
// Initialize the pins as outputs
pinMode(2, OUTPUT); // channel A
pinMode(3, OUTPUT); // channel B
pinMode(4, OUTPUT); // channel C
pinMode(5, OUTPUT); // channel D
pinMode(6, OUTPUT); // channel E
pinMode(7, OUTPUT); // channel F
pinMode(8, OUTPUT); // channel G
pinMode(9, OUTPUT); // channel H
//Uncomment the following line if using this on the EL Escudo Dos.
// Pin 10 is a status LED on the EL Escudo.
// pinMode(10, OUTPUT);
//Pin 13 is the status LED on both the EL Sequencer and Arduino for use with the EL Escudo Dos.
pinMode(13, OUTPUT);
}
Each pin is declared as an output, which will allow us to drive the channel HIGH
or LOW
. We will cycle through each channel, turning them on individually, waiting 1/10 second, turning off, and moving to the next channel.
language:c
/*******************Main Loop***************************/
void loop()
{
int x,status;
//Step through all eight EL channels (pins 2 through 9)
for (x=2; x<=9; x++)
{
digitalWrite(x, HIGH); // turn the EL channel on
delay(100); // wait for 1/10 second
digitalWrite(x, LOW); // turn the EL channel off
//digitalWrite(10, status); //Uncomment this line if using the EL Escudo Dos
digitalWrite(13, status); // blink status LEDs
status = !status;
}
}
Each time a channel is cycled through, the status LEDs on the board will blink.
Once the code is uploaded, you should see each strand of EL wire light up one by one. If you aren't seeing that, verify that you have the correct power settings on the USB/Batt switch, and that the inverter is connected properly, switched on (if using the 12V inverter), and that the power supply to the board is properly charged and/or connected.