Read DigitalIn and send UART message using UART 3
Revision 0:09cb1c9e1957, committed 2019-03-28
- Comitter:
- rajas1812
- Date:
- Thu Mar 28 03:45:45 2019 +0000
- Commit message:
- Read DigitalIn and send UART message using UART 3
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 28 03:45:45 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+DigitalIn enable(PTB23);
+Serial display(USBTX,USBRX); //UART0
+Serial device(PTC17, PTC16); //UART3
+
+int main() {
+ display.baud(115200);
+ device.baud(115200);
+ display.printf("Motor controller");
+
+ while(1) {
+ if(enable == 1) {
+ display.printf("Go FAST!!!!!\n\r");
+ device.printf("1");
+ }
+ else
+ {
+ display.printf("Go at your own speed\n\r");
+ device.printf("2");
+ }
+ wait(0.25);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 28 03:45:45 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file