Hallo,
Ich habe ein Problem mit meinem Lauflicht.
Da ich nicht das richtige sketch habe/finde/umschreiben kann/selber schreiben kann.
Allgemein zu meinem Aufbau:
-Arduino Mirco
-3x 74HC595
-24x Vorwiderstand
-24xLED in Rot
Die verkabelung ist korrekt und nach arduino.cc website aufgebaut.
Funktioniert auch fehlerfrei,ABER nur in eine Richtung (von links nach rechts).
Es sollte aber auch in die andere Richtung laufen.
Da die Arduinosache für mich aber neuland ist habe ich erstmal ein sketch geladen damit ich die funktion überprüfen kann(sketch siehe unten)
Es sollte aber nach möglichkeit so funktionieren wie im angegebenen youtube link(auch unten)
Wäre super wenn mir da mal einer untert die Arme greifen kann.
Probiere schon seit langer zeit rum,aber immer erfolglos.
Wäre schön wenn es mal einen erfolg gibt.
Sketch:
int dataPin = 10;
int latchPin = 11;
int clockPin = 12;
void setup(){
// Set the data, latch and clock pins to output mode.
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop(){
// Setup array with the individual LED positions. Decimal is easier to use than binary.
unsigned int displayLED[] = {
0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768};
// Setup two 8 bit bytes to hold the data for each 595.
uint16_t low_byte;
uint16_t high_byte;
// Set length of time to display each LED.
int pause = 45;
// Loop control variable
int count;
// Count up loop.
for(count = 1; count < 24; count++){
// Read the decimal value from the array. Use bitwise And with OxFF for the low byte
// and shift 8 bits right for the high byte.
//
// I learned this from Korman at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285651171
//
low_byte = displayLED[count] & 0xff;
high_byte = (displayLED[count] >> 8);
// set the latch pin low prior to shifting out the data.
digitalWrite(latchPin, LOW);
// Shift out the data. The first shiftout puts the high byte into the first 595.
// The second shiftout shifts the high byte from the first 595 to the second and
// shifts the low byte into the first 595.
shiftOut(dataPin, clockPin, MSBFIRST, high_byte);
shiftOut(dataPin, clockPin, MSBFIRST, low_byte);
// Display the data by setting the latch pin high.
digitalWrite(latchPin, HIGH);
// Pause for the number of miliseconds determined by the 'pause' variable.
delay(pause);
}
//Count down loop. Same as the count up loop but moves in the opposite direction.
for(count = 24; count > 0; count--){
low_byte = displayLED[count] & 0xff;
high_byte = (displayLED[count] >> 8);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, high_byte);
shiftOut(dataPin, clockPin, MSBFIRST, low_byte);
digitalWrite(latchPin, HIGH);
delay(pause);
}
}
Youtubelink: