I have tried to make a sketch were I use button 1 to turn the LED 1 on when it's pressed and off when it is not. I get the LED to turn on with digitalWrite(ledPin, HIGH); but when I try to do something like this it does not work { if(btnPin1 == 1) digitalWrite(ledPin, HIGH); else digitalWrite(ledPin, LOW); } . I have tried with both buttons and can not seem to get it to recognize the button being pressed. Is it the code? I have the manual for revision C which I do not know what revision mine is but I bought it recently so I figured it had to be RevC. Another thing when my board was new i had to flash the bootloader because in MPLAB IPE not IDE I think I erased the loader so I uploaded it again everything else looks like its working normal just the buttons that I can't figure out. Could I get some help please.
Question
jbirriel84
I have tried to make a sketch were I use button 1 to turn the LED 1 on when it's pressed and off when it is not. I get the LED to turn on with digitalWrite(ledPin, HIGH); but when I try to do something like this it does not work { if(btnPin1 == 1) digitalWrite(ledPin, HIGH); else digitalWrite(ledPin, LOW); } . I have tried with both buttons and can not seem to get it to recognize the button being pressed. Is it the code? I have the manual for revision C which I do not know what revision mine is but I bought it recently so I figured it had to be RevC. Another thing when my board was new i had to flash the bootloader because in MPLAB IPE not IDE I think I erased the loader so I uploaded it again everything else looks like its working normal just the buttons that I can't figure out. Could I get some help please.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.