Quantcast
Channel: fritzing forum - Latest posts
Viewing all articles
Browse latest Browse all 29620

Schematic to breadboard layout

$
0
0

/*
Adafruit Arduino - Lesson 4. 8 LEDs and a Shift Register
*/

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;

byte leds = 1;

void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}

void loop()
{
leds = 1;
updateShiftRegister();
delay(500);
for (int i = 0; i < 8; i++)
{
bitSet(leds, 1);
updateShiftRegister();
delay(500);
}
}

void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}

as soon as I attempt to remove the loop "for (int i = 0; i < 8; i++)
{" is says that "updateShiftRegister(); was not declared in this scope. It's winding me up, it's probably something I'm missing and simple but I just don't know


Viewing all articles
Browse latest Browse all 29620

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>