A program to test a library with which a mbed receives a char, or a line until enter as a command, and execute registered functions. If nothing is registered, the library function just echo the command.
Dependencies: mbed SerialInputReactionHandler
main.cpp
- Committer:
- aktk
- Date:
- 2020-10-21
- Revision:
- 0:27eb52652bc3
File content as of revision 0:27eb52652bc3:
#include "mbed.h"
#include "SerialInputReactionHandler.h"
int main()
{
// Initialise the digital pin LED1 as an output
DigitalOut led(LED1);
SerialInputReactionHandler reactor;
Serial pc(USBTX, USBRX, 921600);
pc.attach(callback(&reactor, &SerialInputReactionHandler::key_bind));
while (true) {
led = !led;
wait(.5);
}
}