IT Tralee Life Long Learning 2020 Instrumentation, Monitoring and Control Module Laboratory Session

Dependencies:   mbed C12832 mbed-rtos lab1 LCD_fonts

Files at this revision

API Documentation at this revision

Comitter:
alejandromontes
Date:
Mon Jul 27 20:33:39 2020 +0000
Parent:
3:3ec443c0842a
Commit message:
Alejandro Montes Instrumentation Monitoring and Control LAB

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
C12832_lcd.lib Show diff for this revision Revisions of this file
Experiment_5.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3ec443c0842a -r 4a9fa226b7a5 C12832.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Mon Jul 27 20:33:39 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
diff -r 3ec443c0842a -r 4a9fa226b7a5 C12832_lcd.lib
--- a/C12832_lcd.lib	Wed Dec 05 08:06:20 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/dreschpe/code/C12832_lcd/#8d812da33cdc
diff -r 3ec443c0842a -r 4a9fa226b7a5 Experiment_5.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Experiment_5.lib	Mon Jul 27 20:33:39 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dreschpe/code/lab1/#3ec443c0842a
diff -r 3ec443c0842a -r 4a9fa226b7a5 main.cpp
--- a/main.cpp	Wed Dec 05 08:06:20 2012 +0000
+++ b/main.cpp	Mon Jul 27 20:33:39 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;
 
@@ -93,8 +98,19 @@
     Thread::wait(500);    // wait 0.5s
 }
 }
-
-
+// Thread 5
+// control the leds with the joystick
+void thread5(void const *args){
+    
+    while(1) {
+        if (fire) {
+            leds=0xf;
+        } else {
+            leds=joy;
+        }
+        wait(0.1);
+    }
+}               
 // print the actual contrast 
 int main()
 {
@@ -105,6 +121,7 @@
     Thread t2(thread2); //start thread2
     Thread t3(thread3); //start thread3
     Thread t4(thread4); //start thread4
+    Thread t5(thread5); //start thread5
 
     while(true) {       // main is the next thread
         lcd_mutex.lock();