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
main.cpp
- Committer:
- rossng
- Date:
- 2016-01-30
- Revision:
- 0:0513e7187b87
- Child:
- 1:6feb61c0e4a1
File content as of revision 0:0513e7187b87:
#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);
}
}