Lab Day 2, Experiment 2.5: Threads and programming

Dependencies:   mbed mbed-rtos C12832_lcd LCD_fonts

Files at this revision

API Documentation at this revision

Comitter:
t00209054
Date:
Sun Aug 02 11:55:37 2020 +0000
Parent:
3:3ec443c0842a
Commit message:
v2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3ec443c0842a -r 6b5f8f26d1ed main.cpp
--- a/main.cpp	Wed Dec 05 08:06:20 2012 +0000
+++ b/main.cpp	Sun Aug 02 11:55:37 2020 +0000
@@ -10,6 +10,11 @@
 #include "stdio.h"
 #include "C12832_lcd.h"
 
+BusIn joy(p15,p12,p13,p16);
+DigitalIn fire(p14);
+
+BusOut leds(LED1,LED2,LED3,LED4);
+
 // LCD object
 C12832_LCD LCD;
 
@@ -94,6 +99,19 @@
 }
 }
 
+// Thread 5
+// input joystick to control LED lights
+void thread5(void const *args)
+{
+    while(1) {
+        if (fire) {
+            leds=0xf;
+        } else {
+            leds=joy;
+        }
+        wait(0.1);
+    }
+}
 
 // print the actual contrast 
 int main()