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.
Fork of TAIST_modbus by
Diff: main.cpp
- Revision:
- 0:f306cb0263a6
- Child:
- 1:c5e6595a03db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 14 06:17:48 2018 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "modbus.h"
+
+DigitalOut myled(LED1);
+RawSerial pc(USBTX, USBRX);
+
+void serial_callback()
+{
+ uint8_t frame[6];
+
+ char ch = pc.getc();
+ if (modbus_parser(ch, frame)) {
+
+ }
+}
+
+int main() {
+ // setup code
+ pc.attach(serial_callback);
+ // 1. button code
+ // 2. timer code
+ while(1) {
+ // loop code
+ myled = 1; // LED is ON
+ wait(0.2); // 200 ms
+ myled = 0; // LED is OFF
+ wait(1.0); // 1 sec
+ }
+}
