I running through the basic projects with my Mega 2560 project kit and ran into a problem with one. The amber LED on the board flashes but nothing responds on the board and I get the error. Here is my error copied-
Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\cdr14\Desktop\Elegoo Basic Starter Kit for Mega 2560 V1.0.2019.03.04\code\Lesson 11 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino: In function 'void updateShiftRegister()':
Eight_LED_with_74HC595_Flash_LED:16:4: error: expected initializer before 'digitalWrite'
digitalWrite(latchPin, HIGH);
^
C:\Users\cdr14\Desktop\Elegoo Basic Starter Kit for Mega 2560 V1.0.2019.03.04\code\Lesson 11 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino: At global scope:
Eight_LED_with_74HC595_Flash_LED:26:1: error: expected unqualified-id before '{' token
{
^
exit status 1
expected initializer before 'digitalWrite'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here is the coding from the project, I havent changed anything
int tDelay = 100;
int latchPin = 11; // (11) ST_CP [RCK] on 74HC595
int clockPin = 9; // (9) SH_CP [SCK] on 74HC595
int dataPin = 12; // (12) DS [S1] on 74HC595
byte leds = 0;
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
void loop()
digitalWrite(latchPin, HIGH);
}
void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
{
leds = 0;
updateShiftRegister();
delay(tDelay);
for (int i = 0; i < 8; i++)
{
bitSet(leds, i);
updateShiftRegister();
delay(tDelay);
}
}
Image url-
Any ideas?? Thanks in advance.