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>
- #include<data.h>
- extern serial Serial;
- int suma=0;
- void proveri(int a,void *b){
- if(available()){ // proveri da li ima ucitanih podataka
- char *podatak=read();
- int pristili_podatak=atoi(podatak+21); // zato sto od 21. karaktera krece broj
- Serial.print("Ucitani podatak: ");
- Serial.println(pristili_podatak);
- suma+=pristili_podatak;
- Serial.print("Suma pristiglih podataka: ");
- Serial.println(suma);
- delete[] podatak; // da ne dodje do curenja memorije
- }
- }
- void setup()
- {
- Serial.begin(9600);
- startStopDataGeneration(START_GENERATION,RANDOM,0,100,0.2,500);
- createTask(proveri,50,TASK_ENABLE,NULL);
- }
- void loop()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement