Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos C12832_lcd LCD_fonts
Diff: main.cpp
- Revision:
- 4:23fbf558b971
- Parent:
- 3:3ec443c0842a
diff -r 3ec443c0842a -r 23fbf558b971 main.cpp
--- a/main.cpp Wed Dec 05 08:06:20 2012 +0000
+++ b/main.cpp Mon Dec 20 19:22:25 2021 +0000
@@ -16,6 +16,12 @@
AnalogIn Pot1(p19);
AnalogIn Pot2(p20);
+//JOYSTICK
+BusIn joy(p15,p12,p13,p16);
+DigitalIn fire(p14);
+
+BusOut leds(LED1,LED2,LED3,LED4);
+
// mutex to make the lcd lib thread save
Mutex lcd_mutex;
@@ -94,6 +100,21 @@
}
}
+// Thread 5
+// input joystick and change LED
+void thread5(void const *args)
+
+{
+ int main();
+ while(1) {
+ if (fire) {
+ leds=0xf;
+ } else {
+ leds=joy;
+ }
+ wait(0.1);
+ }
+}
// print the actual contrast
int main()
@@ -105,7 +126,8 @@
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();
LCD.locate(0,9);