Guest User

Untitled

a guest
Nov 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <16f628.h>
  2. #use delay(clock=4M)
  3. #define led1 pin_a0
  4. #define led2 pin_a1
  5. #define tasto1 pin_a2
  6.  
  7. void led_1(); //  led1
  8. void led_2(); //  led2
  9. void tasto_1(); //   tasto1
  10.  
  11.  
  12.  
  13. int main(){
  14.  
  15.    led_1();
  16.    led_2();
  17.    while(1)
  18.     tasto_1();
  19.    return 0;
  20.  
  21. }
  22.  
  23. void led_1(){
  24.    output_high(led1); // accende led2 su pin a1
  25.    delay_ms(500);
  26.    output_low(led1); // spegne led2 su pin a1
  27.    delay_ms(500);
  28. }
  29.  
  30. void led_2(){
  31.    
  32.    {
  33.    output_high(led2); // accende led2 su pin a1
  34.    delay_ms(500);
  35.    output_low(led2); // spegne led2 su pin a1
  36.    delay_ms(500);
  37.    }
  38. }
  39.  
  40. void tasto_1(){
  41.    if(!tasto1==1)
  42.       output_high(led1);
  43.          else
  44.          output_low(led1);
  45.          
  46. }
Add Comment
Please, Sign In to add comment