====== Starting Lights by Juan Pardo ====== It is an Arduino based system. You will find below details for building the device provided by the Author. ===== Mounting the device ===== {{ :startinglights:startinglights_1.jpg?200 |}} {{ :startinglights:startinglights_2.jpg?200 |}} ==== Code ==== //============================================================================== // Program: ZRound.ino // Author: Juan Pardo // Target: UNO R3, IDE 1.0.5 // Date: 2013/08/12 // Time: 02:32 // Notes: // Uses Serial I/O // Reference: //============================================================================== #define VERSION 0.7 //=====[ INCLUDE ]============================================================== //=====[ CONSTANTS ]============================================================ #define CMD_START "$START" #define CMD_STOP "$STOP" #define ANS_GO "$GO" #define bSize 64 #define L_OFF HIGH #define L_ON LOW //=====[ PINS ]================================================================= int DebugLed = 13; //=====[ VARIABLES ]============================================================ char Buffer[bSize]; // Serial buffer char ShadowBuffer[bSize]; // Serial buffer char Command[10]; byte LightPort[]={4,5,6,7,8,9}; // Last port will be used as green light byte LIGHTS; byte GREENLIGHT; //=====[ ReadSerialCommand ]==================================================== int ReadSerialCommand(void) { int BytesCount = -1; BytesCount = Serial.readBytesUntil('\n',Buffer,bSize-1); if (BytesCount > 0) { Buffer[BytesCount]='\0'; } else{ Buffer[0]='\0'; } return BytesCount; } //=====[ LightsOFF ]============================================================= void LightsOFF(void) { for(int i=0;i0){ strcpy(ShadowBuffer,Buffer); strcpy(Command,strtok(ShadowBuffer,",")); if(strcmp(Command, CMD_START)==0){ LightsOFF(); for(int i=0;i