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 BTN4 37
- int pocetno_vreme,vreme_izvrsavanja;
- int blink_var;
- int blinkid;
- void blink_task1(int id,void *tptr){
- static int pocetno_vreme=millis(); // meri od pocetka izvrsavanja ovog taska
- static int vreme_izvrsavanja=0;
- int dugme4=digitalRead(BTN4);
- if(dugme4==HIGH){
- digitalWrite(LD8,HIGH);
- vreme_izvrsavanja=millis()-pocetno_vreme;
- }else{
- digitalWrite(LD8,LOW);
- if(vreme_izvrsavanja>2000){
- pocetno_vreme=millis();
- vreme_izvrsavanja=0;
- executeSoftReset(0);
- }else{
- vreme_izvrsavanja=0;
- pocetno_vreme=millis();
- }
- }
- }
- void setup()
- {
- pinMode(LD8,OUTPUT);
- blinkid=createTask(blink_task1,50,TASK_ENABLE,&blink_var);
- }
- void loop()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement