Jonathan Larsen
Jonathan Larsen

Reputation: 11

Arduino Uno code broken

I am having trouble making this binary counter, to count minutes and seconds. When I try to verify, I get the error below. How do I fix this broken code?

Error message

Expected `;' before '}' token

Code

#define DATA 0
#define LATCH 1
#define CLOCK 2
#define DATA2 3
#define LATCH2 4
#define CLOCK2 5

void setup()

(

    pinMode{LATCH, OUTPUT};
    pinMode(CLOCK, OUTPUT);
    pinMode(DATA, OUTPUT);
    pinMode(LATCH2, OUTPUT);
    pinMode(CLOCK2, OUTPUT);
    pinMode(DATA2, OUTPUT);
)

void loop()
{
    int i;
    for (i = 0; i < 256; i++)
    {
        digitalWrite(LATCH, LOW);
        shiftOut(DATA, CLOCK, MSBFIRST, i);
        digitalWrite(LATCH, HIGH);
        delay(200);
    }
    int c;
    for (c = 0; c < 256; c++)
    {
        digitalWrite(LATCH2, LOW);
        shiftOut(DATA2, CLOCK2, MSBFIRST, c);
        digitalWrite(LATCH2, HIGH);
        delay(100)
    }
}

Upvotes: 0

Views: 88

Answers (1)

Peter Mortensen
Peter Mortensen

Reputation: 31618

The problem is in this section (also pinMode{LATCH, OUTPUT};, as in comments):

void setup()

(

    pinMode{LATCH, OUTPUT};
    pinMode(CLOCK, OUTPUT);
    pinMode(DATA, OUTPUT);
    pinMode(LATCH2, OUTPUT);
    pinMode(CLOCK2, OUTPUT);
    pinMode(DATA2, OUTPUT);
)

The parenthesis pair should be a pair of curly brackets (braces):

void setup()

{

    pinMode(LATCH, OUTPUT);
    pinMode(CLOCK, OUTPUT);
    pinMode(DATA, OUTPUT);
    pinMode(LATCH2, OUTPUT);
    pinMode(CLOCK2, OUTPUT);
    pinMode(DATA2, OUTPUT);
}

Upvotes: 2

Related Questions