Code:
//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;
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available())
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, Serial.read());
digitalWrite(latchPin, HIGH);
// non credo serva il delay, dato che aspetta un altro valore
// delay(500);
}
}
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available())
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, Serial.read());
digitalWrite(latchPin, HIGH);
// non credo serva il delay, dato che aspetta un altro valore
// delay(500);
}
}

