Thread example of multiple things happening at once. Requires mbed OS 5 and up-to-date mbed firmware.

Dependencies:   Motor Servo

Fork of Fa2018-es200-1121-3321-thread-example-peanut by Fa2018-es200-3321-proj2-GoodTeam#2

Revision:
4:6ccbc7542ddc
Parent:
3:68bba10e81aa
Child:
5:0c7c692db414
--- a/main.cpp	Sun Oct 14 22:00:35 2018 +0000
+++ b/main.cpp	Sun Oct 14 22:05:59 2018 +0000
@@ -21,7 +21,16 @@
 Thread m_thread; // NEW IN mbed OS 5, threads are used to (sorta) do multiple things at once
 Thread s1_thread;
 
+/**
+ * Callback for executing a simple motor action. When sw1 is high,
+ * the motor turns forward, otherwise the motor turns off.
+ */
 void m_callback(void); // This function will be run within the corresponding thread
+
+/**
+ * Simple callback for servo motion. When sw2 is high, the servo steps right,
+ * otherwise it steps left. If it hits the ends it stays there.
+ */
 void s1_callback(void);
 
 // main() runs in its own thread in the OS
@@ -49,10 +58,6 @@
 
 
 
-/**
- * Callback for executing a simple motor action. When sw1 is high,
- * the motor turns forward, otherwise the motor turns off.
- */
 void m_callback(void){
     printf("m_thread running\n");
     while(1) {
@@ -70,10 +75,6 @@
     
     
     
-/**
- * Simple callback for servo motion. When sw2 is high, the servo steps right,
- * otherwise it steps left. If it hits the ends it stays there.
- */
 void s1_callback(void){
     printf("s1_thread running\n");    
     while(1){