aboutsummaryrefslogtreecommitdiff
path: root/Arduino
diff options
context:
space:
mode:
authorAdam Martindale <awiamartindale@googlemail.com>2011-09-07 17:08:56 +0100
committerAdam Martindale <awiamartindale@googlemail.com>2011-09-07 17:08:56 +0100
commitc13af0b6901ce6478a21233d0868969d06a6bc9a (patch)
treeb764d38ddd49d84ad718cb825ff6c15e4c68d17a /Arduino
parent3b1f8bc3e446dfc18a25987b25247abfbcee730e (diff)
downloadpunchingbag-c13af0b6901ce6478a21233d0868969d06a6bc9a.tar
punchingbag-c13af0b6901ce6478a21233d0868969d06a6bc9a.tar.gz
:Arduino Serial commands added
Diffstat (limited to 'Arduino')
-rw-r--r--Arduino/LEDMatrix/LEDMatrix.pde50
1 files 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();
}
+
+
+
+
+
+
+
+
+