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.
Diff: main.cpp
- Revision:
- 0:a2ecd3b777ac
- Child:
- 1:c97e837e48a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Nov 26 13:41:01 2011 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "USBSerial.h"
+#include "TextLCD.h"
+
+//an LED to display activity
+DigitalOut serial_activity_led(LED2);
+//Virtual serial port over USB
+USBSerial serial;
+//The TextLCD
+TextLCD lcd(p21, p22, p17, p18, p19, p20); // rs, e, d4-d7
+
+int main() {
+ //initialise the LCD
+ lcd.printf("FlightSimInstru\nready!");
+
+ //setup some buffers - using ints crashed my mbed, not sure why
+ uint8_t ias[128];
+ uint8_t alt[128];
+ //clear them
+ memset(ias,0,sizeof(ias)*sizeof(*ias));
+ memset(alt,0,sizeof(alt)*sizeof(*alt));
+
+ //toggle an LED to show us, that the mbed is alive.
+ while(1) {
+ //read two space separated strings
+ serial.scanf("%s %s", ias, alt);
+ //write them on the LCD
+ lcd.cls();
+ lcd.printf("Speed: %s\nAlt: %s", ias, alt);
+ //toggle activity LED
+ serial_activity_led = !serial_activity_led;
+ }
+}