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: NeoStrip SerialDriver mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:0513e7187b87
- Child:
- 1:6feb61c0e4a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jan 30 20:10:17 2016 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "SerialDriver.h"
+
+SerialDriver pc(p9, p10);
+DigitalOut myled(LED1);
+
+int flash();
+
+int main()
+{
+ // setup serial port
+ pc.baud(115200);
+
+ char* line_buffer = (char*) malloc(100*sizeof(char));
+
+ char c = pc.getc();
+ int pos = 0;
+
+ while (c != '\n' && c != '\r') {
+ line_buffer[pos] = c;
+ c = pc.getc();
+ }
+
+ pc.printf("ack\n");
+
+ int result = strcmp(line_buffer, "hello");
+
+ if (result == 0) {
+ flash();
+ }
+}
+
+
+int flash() {
+ while(1) {
+ myled = 1;
+ wait(0.2);
+ myled = 0;
+ wait(0.2);
+ }
+}
\ No newline at end of file