From c13af0b6901ce6478a21233d0868969d06a6bc9a Mon Sep 17 00:00:00 2001 From: Adam Martindale Date: Wed, 7 Sep 2011 17:08:56 +0100 Subject: :Arduino Serial commands added --- Arduino/LEDMatrix/LEDMatrix.pde | 50 ++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/Arduino/LEDMatrix/LEDMatrix.pde b/Arduino/LEDMatrix/LEDMatrix.pde index 0d3994b..18a00ae 100644 --- a/Arduino/LEDMatrix/LEDMatrix.pde +++ b/Arduino/LEDMatrix/LEDMatrix.pde @@ -9,26 +9,56 @@ const byte CsnPin = 2 ; // Chip select (Low active) const byte ClkPin = 3 ; // Serial Clockq const byte DataPin = 4 ; // Serial Data -byte buffer [ 8 ] ; // Screen buffer (No. of modules * 8) +const int chips = 6; + +byte buffer [ chips * 8 ] ; // Screen buffer (No. of modules * 8) AS1107 matrix ( CsnPin, ClkPin, DataPin ) ; const byte d = 0 ; int count= 1 ; void setup ( ) { - matrix. Init ( buffer, 7, 7, 0 ) ; + matrix. Init ( buffer, (chips*8)-1, 7, chips -1 ) ; + Serial.begin(9600); } void loop ( ) { - for (int x=0; x<8; x++) { - for (int y=0; y<8; y++) { - matrix.SetLed(x,y,1); - matrix.Update(); - delay(1000); - matrix.SetLed(x,y,0); - matrix.Update(); - delay(1000); + int timer = 0; + + if (Serial.read() == ((byte)108)) { + Serial.println("L Recieved"); + while (Serial.peek() == -1) { + } + if (Serial.read() == ((byte)101)) { + while (Serial.peek() == -1) { + } + Serial.println("E recieved"); + for (int i = 0; i < (chips*8); i++) { + while (Serial.peek() == -1) { + } + buffer[i] = Serial.read(); + + Serial.println(buffer[i]); + + } + Serial.println("Buffer Recieved"); + + } + + + + } + matrix.Update(); } + + + + + + + + + -- cgit v1.2.3