Advertisement
Guest User

wtf

a guest
Nov 15th, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.50 KB | None | 0 0
  1. #include <18F46K20.h>
  2. #use delay(clock=4000000)
  3. #fuses INTRC_IO, NOWDT, BROWNOUT,NOPROTECT, PUT, MCLR, NOLVP
  4.  
  5. //i=bottone + /j=bottone - /k=frequenza
  6. unsigned int i,j,k;
  7. #define LED1 PIN_B5
  8. #define LED2 PIN_B4
  9. #define LED3 PIN_B3
  10. #define LED4 PIN_B2
  11. #define LED5 PIN_B1
  12. #define LED6 PIN_B0
  13. #define LED7 PIN_D7
  14. #define BUTT1 PIN_D3
  15. #define BUTT2 PIN_D2
  16.  
  17. void main(){
  18.   setup_oscillator(OSC_4MHZ);
  19.   output_high(LED1);
  20.   output_high(LED2);
  21.   output_high(LED3);
  22.   output_high(LED4);
  23.   output_high(LED5);
  24.   output_high(LED6);
  25.   delay_ms(100);
  26.   output_low(LED1);
  27.   output_low(LED2);
  28.   output_low(LED3);
  29.   output_low(LED4);
  30.   output_low(LED5);
  31.   output_low(LED6);
  32.   delay_ms(100);
  33.   k=50;
  34.   while (1) {
  35.       i=input(BUTT1);
  36.       j=input(BUTT2);
  37.       if (i==1) {
  38.           if (k<200) {
  39.           k=k+10;
  40.           output_high(LED7);
  41.           delay_ms(100);
  42.           output_low(LED7);
  43.           }
  44.           if (k=210) {
  45.           k=200;
  46.           output_high(LED7);
  47.           delay_ms(300);
  48.           output_low(LED7);
  49.           }
  50.       }
  51.       if (j==1) {
  52.           if (k>9) {
  53.           k=k-10;
  54.           output_high(LED7);
  55.           delay_ms(100);
  56.           output_low(LED7);
  57.           }
  58.           if (k=0) {
  59.           k=10;
  60.           output_high(LED7);
  61.           delay_ms(300);
  62.           output_low(LED7);
  63.           }
  64.       }
  65.      delay_ms(50);
  66.      }
  67.  
  68.   while (1) {
  69.       output_high(LED1);
  70.       delay_ms(k);
  71.       output_low(LED1);
  72.       delay_ms(k);
  73.   }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement