Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<arduinoPlatform.h>
- #include<tasks.h>
- #include<interrupts.h>
- #include<stdio.h>
- #include<serial.h>
- #include<pwm.h>
- extern serial Serial;
- #define LD8 33
- #define PIN1 2
- #define PIN2 7
- #define PIN3 8
- #define PIN4 35
- int blink_id1,blink_id2;
- void blink_task1(int id,void *tptr){
- digitalWrite(LD8,!digitalRead(LD8));
- }
- void blink_task2(int id,void *tptr){
- int brojac=0;
- if(digitalRead(PIN1)==HIGH) brojac++;
- if(digitalRead(PIN2)==HIGH) brojac++;
- if(digitalRead(PIN3)==HIGH) brojac++;
- if(digitalRead(PIN4)==HIGH) brojac++;
- setTaskPeriod(blink_id1,brojac*100); // mora se direktno proslediti f-ji taj id
- }
- void setup()
- {
- pinMode(LD8,OUTPUT);
- blink_id1=createTask(blink_task1,100,TASK_ENABLE,NULL); // na svakih 100ms pali i gasi LD8
- blink_id2=createTask(blink_task2,1000,TASK_ENABLE,NULL);
- }
- void loop()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement