Hello,
I'm not a strong programer so any help would be appreciated.
i have a Serial.read of 0 coming in, so when ever a new 0 comes in i want to move down the array.
example: when 0 comes in hit first array index and assign it to incomingByte. when next 0 comes in hit the array 2nd index and assign that to incomingByte and so on.
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int numberToDisplay;
int incomingByte = 0;
int python[] = {1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6};
void setup() {
//set pins to output so you can control the shift register
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
// read the incoming byte:
numberToDisplay = Serial.read()-48;
// say what you got:
Serial.print("I received: ");
Serial.println(numberToDisplay);
}
// take the latchPin low so
// the LEDs don't change while you're sending in bits:
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin, clockPin, MSBFIRST, incomingByte);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
// pause before next value:
delay(50);
}