Threads + Network Demo

Dependencies:   EthernetInterface mbed-rtos mbed-src

Fork of TestNetComm by Malcolm Nixon

Files at this revision

API Documentation at this revision

Comitter:
MalcolmNixon
Date:
Sun May 04 03:05:22 2014 +0000
Parent:
2:d62b28f02d45
Child:
4:f2789e665f4e
Commit message:
Added blink timer

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun May 04 02:49:24 2014 +0000
+++ b/main.cpp	Sun May 04 03:05:22 2014 +0000
@@ -2,22 +2,22 @@
 #include "Thread.h"
 #include "mbed.h"
 
-void ledThreadProc(const void *param)
-{
-    DigitalOut led2(LED2);
+DigitalOut led2(LED2, 1);
     
-    for (;;)
-    {
-        led2 = !led2;
-        Thread::wait(500);
-    }
+// Blink function
+void blink(const void *param)
+{
+    led2 = !led2;
 }
-    
 
 int main(void)
 {
     // Create a digital output on LED1
-    DigitalOut led1(LED1);
+    DigitalOut led1(LED1, 1);
+
+    // Start the blink timer at 1 second interval
+    RtosTimer timer(blink);
+    timer.start(1000);
     
     // Construct the Ethernet interface
     EthernetInterface eth;