I would like to use a PIC18F458 that has a button (on RB4) to switch on a led (on A0, for example) if the button is pressed for 4 seconds and not if not. =)
Do i better have to use interrupts ? Or something else ?
Do you have a program to help me ?
Thanks a lot.
Best regards.
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
Posted: Fri Mar 25, 2005 9:47 am
You will see that this forum is plenty of proposal like yours, the idea is
that you must do the first movement posting a small but complete
C source code to enable us to know what and how are you
trying to do it.
If you tried starting with the examples provided with the CCS compiler
package I�m sure you are ready for this. Once you post your code we will
correct, criticize and propose some tips to guide you.
Best wishes,
Humberto
Guest
Posted: Tue Mar 29, 2005 9:26 am
ok thanks, i found this which works quite well :
Code:
If (!input(BUTTON)){ // Wait for Enter Button to be pressed
while (!input(BUTTON)); // Wait for Enter Button to be released
delay_ms(3000); // Delay 3 s
output_high(LED_1);} // LED_1 ON
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum