CodeForumUser333
New Coder
C++:
int led = 13;
int pushButton = 2;
void setup () {
Serial.begin(9600);
pinMode{pushButton, INPUT);
pinMode(led, OUTPUT);
}
void loop () {
int buttonState = digitalRead(pushButton);
Serial.printIn(buttonState);
if (buttonState != 1) {
digitalWrite(led, HIGH);
} else {
digitalWrite (led, LOW);
}
delay(1);
}
Hi, so these lines of codes are meant for Tinkercad Arduino. As you can see, these lines of codes were meant to start a circuit but I don't understand what went wrong. It indicated me the errors of this script but due to the fact that I am a complete newbie to coding, I just can't seem to understand. Can anyone be of help? Thanks.
Error details:
In function 'void setup()':
11:10: error: expected ';' before '{' token
17:13: error: a function-definition is not allowed here before '{' token
31:1: error: expected '}' at end of input exit status 1
Last edited by a moderator: