#include #include "LedControl.h" #include Servo panservo; int panpos = 0; Servo tiltservo; int tiltpos = 0; int xpin = 0; int ypin = 1; LedControl lc=LedControl(4,5,6,2); void setup() { Serial.begin(115200); panservo.attach(2); tiltservo.attach(3); lc.shutdown(0,false); lc.shutdown(1,false); /* Set the brightness to a medium values */ lc.setIntensity(0,5); lc.setIntensity(1,5); } void full(int matrix) { for(int col=0;col<8;col++) { lc.setRow(matrix,col,B11111111); } } void checkMessages(){ char c = Serial.read(); // get the first character while (c != 2){c = Serial.read();} // if its not STX, keep going till it is // (though this is bad!) if (c == 2){ // now that we have STX int matrix = Serial.read(); int row = 0; while (true) { // loop through all new date till we get ETX c = Serial.read(); //scratch += c; lc.setRow(matrix, row, c); row++; if (row>=8) { break; } } Serial.print("Got a message for matrix"); Serial.println(matrix); } } void loop() { checkMessages(); }