Model Railroad System
2.2.1
Model RR signals with an Arduino
|
This is the software downloaded to the Ardunio to interface to the MAX72XX LED multiplexer driving the signals. More...
Macros | |
#define | R_R B00001001 |
Red over Red (Stop) More... | |
#define | R_Y B00001010 |
Red over Yellow (Approach Limited) More... | |
#define | R_G B00001100 |
Red over Green (Slow Clear) More... | |
#define | Y_R B00010001 |
Yellow over Red (Approach) More... | |
#define | G_R B00100001 |
Green over red (Clear) More... | |
#define | DARK B00000000 |
Dark (all lights off) More... | |
Functions | |
void | setup () |
The setup function initializes the MAX72xx chip and sends an announcement to the host computer over the serial port. More... | |
int | GetAspectBits (const char *aspectname) |
Test for each signal aspect string and when a match Occurs, return the corresponding bit pattern. More... | |
void | loop () |
The main loop function. More... | |
Variables | |
LedControl | lc1 =LedControl(12,11,10,1) |
Create a new LedControl. More... | |
int | s_digit |
Start digit. More... | |
int | e_digit |
End digit. More... | |
int | i_digit |
Current digit. More... | |
int | i_bits |
Current bits. More... | |
boolean | test = false |
Flag indicating if we are in test mode. More... | |
This is the software downloaded to the Ardunio to interface to the MAX72XX LED multiplexer driving the signals.
#define DARK B00000000 |
Dark (all lights off)
Definition at line 68 of file SignalDriverMax72xx.ino.
#define G_R B00100001 |
Green over red (Clear)
Definition at line 66 of file SignalDriverMax72xx.ino.
#define R_G B00001100 |
Red over Green (Slow Clear)
Definition at line 62 of file SignalDriverMax72xx.ino.
#define R_R B00001001 |
Red over Red (Stop)
Definition at line 58 of file SignalDriverMax72xx.ino.
#define R_Y B00001010 |
Red over Yellow (Approach Limited)
Definition at line 60 of file SignalDriverMax72xx.ino.
#define Y_R B00010001 |
Yellow over Red (Approach)
Definition at line 64 of file SignalDriverMax72xx.ino.
int GetAspectBits | ( | const char * | aspectname | ) |
Test for each signal aspect string and when a match Occurs, return the corresponding bit pattern.
aspectname | The aspect text sent from the host. |
Definition at line 75 of file SignalDriverMax72xx.ino.
void loop | ( | ) |
The main loop function.
Here we read a one line command from the host computer and decide what to do. There are only three commands defined:
Definition at line 92 of file SignalDriverMax72xx.ino.
void setup | ( | ) |
The setup function initializes the MAX72xx chip and sends an announcement to the host computer over the serial port.
Definition at line 41 of file SignalDriverMax72xx.ino.
int e_digit |
End digit.
Definition at line 29 of file SignalDriverMax72xx.ino.
int i_bits |
Current bits.
Definition at line 33 of file SignalDriverMax72xx.ino.
int i_digit |
Current digit.
Definition at line 31 of file SignalDriverMax72xx.ino.
LedControl lc1 =LedControl(12,11,10,1) |
Create a new LedControl.
We use pins 12,11 and 10 for the SPI interface With our hardware we have connected pin 12 to the DATA IN-pin (1) of the first MAX7221 pin 11 is connected to the CLK-pin(13) of the first MAX7221 pin 10 is connected to the LOAD-pin(12) of the first MAX7221
We will only have a single MAX7221 attached to the arduino
Definition at line 20 of file SignalDriverMax72xx.ino.
int s_digit |
Start digit.
Definition at line 27 of file SignalDriverMax72xx.ino.
boolean test = false |
Flag indicating if we are in test mode.
Definition at line 35 of file SignalDriverMax72xx.ino.