Nebbiolo
Joined: 09 Jun 2019 Posts: 1
|
code to button switch on LCD |
Posted: Sun Jun 09, 2019 6:18 pm |
|
|
Hi! Can anyone help with a solution to my code? I'm new about C language but, I'm learning a little every day. I wrote this code to make a button when pressed, turn on a LED and send to LCD the status of each LED. But I can't make this work properly!
That is what I would like to do:
When press button at RB3, turn on the LED A0 and show at LCD: Door 01,
and when I press again the RB3, turn the other LED A1 and show at LCD: Door 02.
Someone can tell me how to write correctly this code?
Code: |
while(TRUE)
{
if(input(PIN_B3) == 0){
printf(lcd_putc,"\fDOOR 01");
}
if(input(PIN_B3) == 0){
printf(lcd_putc,"\fDOOR 02");
}
if(input(PIN_B3) == 0){
output_toggle(PIN_A0);
output_toggle(PIN_A1);
delay_ms(500);
}
|
Thank you so much for any help! |
|