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: test_input_main.h
- Revision:
- 2:d9745be6c253
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_input_main.h Thu Aug 04 15:14:29 2022 -0400 @@ -0,0 +1,37 @@ +#include <mbed.h> + + + +int main(void) { + BufferedSerial pc(USBTX, USBRX, 9600); + + while (true) { + + // Switch to next state + char input; + ssize_t len = pc.read(&input, 1); + if (len > 0) { + switch (input) { + case '1': + pc.write("u", 1); + break; + case '2': + pc.write("d", 1); + break; + case '3': + pc.write("c", 1); + break; + case '4': + pc.write("i", 1); + break; + case '0': + pc.write("s", 1); + break; + default: + printf("[ERROR, %d] Not a command!\n", __LINE__); + break; + } + } + } + return 0; +} \ No newline at end of file