Advertisement
dusanrs

zadatak63

May 24th, 2022
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<arduinoPlatform.h>
  2. #include<tasks.h>
  3. #include<interrupts.h>
  4. #include<stdio.h>
  5. #include<serial.h>
  6. #include<pwm.h>
  7.  
  8. extern serial Serial;
  9.  
  10. #define prek1 2
  11. #define prek2 7
  12. #define prek3 8
  13. #define prek4 35
  14.  
  15. void konvertuj(int n,void *tptr){
  16.  
  17.     int rezultat=0;
  18.     if(digitalRead(prek1)==HIGH) rezultat+=1;
  19.     if(digitalRead(prek2)==HIGH) rezultat+=2;
  20.     if(digitalRead(prek3)==HIGH) rezultat+=4;
  21.     if(digitalRead(prek4)==HIGH) rezultat+=8;
  22.  
  23.     Serial.print("Rez ");
  24.     Serial.print(rezultat);
  25.     Serial.println(" ");
  26.  
  27.  
  28. }
  29.  
  30.  
  31.  
  32.  
  33. void setup()
  34. {
  35.     Serial.begin(9600);
  36.     createTask(konvertuj,1000,TASK_ENABLE,NULL);
  37. }
  38.  
  39. void loop()
  40. {
  41.  
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement