Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

cleanup for the example

  • Loading branch information...
commit dde74276c8370b4d77adcb1f790a03e3e03e6284 1 parent 365ce52
Brian Larsen authored

Showing 1 changed file with 6 additions and 29 deletions. Show diff stats Hide diff stats

  1. 35  example1/example1.ino
35  example1/example1.ino
@@ -16,7 +16,6 @@
16 16
  *      version, please feel free to fork and/or post patches
17 17
  */
18 18
 
19  
-#include <TimerOne.h>
20 19
 #include <TaskManager.h>
21 20
 
22 21
 // the digital pins that connect to the LEDs
@@ -28,14 +27,6 @@
28 27
 ////////////////////////////////////////////
29 28
 // Demo functions
30 29
 ////////////////////////////////////////////
31  
-void error(void) {
32  
-  #ifdef SERIAL_DEBUG
33  
-    Serial.println("ERROR STATE");  
34  
-  #endif
35  
-  digitalWrite(greenLEDpin, HIGH);
36  
-  digitalWrite(redLEDpin, HIGH);
37  
-}
38  
-
39 30
 
40 31
 class Blink : public Task
41 32
 {
@@ -44,40 +35,26 @@ public:
44 35
   void operator()() {
45 36
     digitalWrite(greenLEDpin, digitalRead(greenLEDpin) ^ 1);
46 37
     #ifdef SERIAL_DEBUG
47  
-      Serial.println("In the ISR");  
  38
+      Serial.println("in Blink");
48 39
     #endif
  40
+
49 41
   }
50 42
 }
51 43
 
52  
-TaskManager TM = TaskManager(1); // 10000 useconds
  44
+TaskManager TM = TaskManager(1); // number of tasks
53 45
 
54  
-Blink blink(50);
55  
-TM.add(blink);
56  
-
57  
-//Task tsk = Task(isr, 100);
58  
-
59  
-//void overflow() {
60  
- // uint8_t i;
61  
-//  for (i=0; i<TM.nTasks; i++){
62  
-//    TM.tasks[i]++; 
63  
-//  }
64  
-//}
  46
+Blink blink(500); // runs every 500 milliseconds
65 47
 
66 48
 void setup()
67 49
 {
68  
-  TM.attach(&tsk, 0); // start at zero
69  
-  Timer1.attachInterrupt( overflow );  // don't want to have to manually do this
70  
-
71  
-  pinMode(greenLEDpin, OUTPUT);   
72 50
   #ifdef SERIAL_DEBUG
73 51
     Serial.begin(19200);
74 52
   #endif
75  
-  
76  
-  TaskManager tm;
  53
+  pinMode(greenLEDpin, OUTPUT);   
  54
+  TM.add(blink);  // add the task to the TM
77 55
 }
78 56
 
79 57
 void loop()
80 58
 {
81  
-  tm++;
82 59
 }
83 60
 

0 notes on commit dde7427

Please sign in to comment.
Something went wrong with that request. Please try again.