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:
- 1:6feb61c0e4a1
- Parent:
- 0:0513e7187b87
- Child:
- 2:868c8a43e4b7
--- a/main.cpp Sat Jan 30 20:10:17 2016 +0000
+++ b/main.cpp Sat Jan 30 20:26:13 2016 +0000
@@ -1,7 +1,8 @@
#include "mbed.h"
#include "SerialDriver.h"
-SerialDriver pc(p9, p10);
+SerialDriver rpi(p9, p10);
+SerialDriver pc(USBTX, USBRX);
DigitalOut myled(LED1);
int flash();
@@ -9,24 +10,30 @@
int main()
{
// setup serial port
- pc.baud(115200);
+ rpi.baud(115200);
char* line_buffer = (char*) malloc(100*sizeof(char));
- char c = pc.getc();
+ char c = rpi.getc();
int pos = 0;
while (c != '\n' && c != '\r') {
line_buffer[pos] = c;
- c = pc.getc();
+ c = rpi.getc();
+ pos++;
}
- pc.printf("ack\n");
+ line_buffer[pos] = '\0';
+
+ rpi.printf("ack\n");
int result = strcmp(line_buffer, "hello");
if (result == 0) {
flash();
+ } else {
+ pc.printf("Did not match.\n");
+ pc.printf(line_buffer);
}
}