What is wrong with my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with my code

https://code.sololearn.com/c3MhDr4PSJlg/?ref=app // C++ code // const int LED =13; const int button = 7; void setup() { pinMode(LED,OUTPUT); pinMode(BUTTON,INPUT); } void loop() { val = digitalRead(BUTON); if(val = high); digitalWrite(LED,HIGH); else digitalWrit(LED,LOW); }

27th Oct 2021, 11:20 PM
Nghia にあ
Nghia にあ - avatar
1 Answer
+ 1
Well, first of all, sololearn coding interface is an isolated space that doesn’t work with librarys like might you are using So what is OUTPUT? What is pinMode? What is high? What is Low? What is digitalWrite? Also u have a typo inside the if statement, if you’re comparing variables use ==, not = as it will assign. And another typo “;” after the if condition
28th Oct 2021, 1:24 AM
Guillem Padilla
Guillem Padilla - avatar