0

Hi I'm new at this and can't figure out why I get this error "void does not name a type" on lines 3,5,8,26

// _2-5 set Debounce Button
const int BUTTON=2;
const int LED=9;
boolean lastButton = LOW;
boolean currentButton = LOW;
boolean ledOn = false;
Void setup()
{
 pinMode (LED, OUTPUT);
 pinMode (BUTTON, INPUT);
}
boolean debounce(boolean last)
{ 
 boolean current = digitalRead(BUTTON);
 if (last != current)
 {
 delay(5);
 current = digitalRead(BUTTON);
 }
 return current;
}
Void loop()
{
 currentButton = debounce(lastButton);
 if (lastButton == LOW && currentButton == HIGH)
 {
 ledOn = !ledOn;
 } 
 lastButton = currentButton;
 digitalWrite(LED, ledOn);
}
Peter Bloomfield
11k9 gold badges48 silver badges87 bronze badges
asked Dec 19, 2014 at 1:12

1 Answer 1

7

I thing the problem is not "void does not name a type", but "Void does not name a type". Subtle difference:

Void setup()

should read:

void setup()

The same on

Void loop()

should be

void loop()

Watch those caps - C is case sensitive.

answered Dec 19, 2014 at 1:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.