lib_Transmission_Serial_example

Dependencies:   lib_Transmission

Committer:
YSI
Date:
Mon Oct 04 11:45:38 2021 +0000
Revision:
18:f2f2c951f5a4
Parent:
10:0ab5c8865667
change example name

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YSI 0:5d2c38c99ce6 1 #include "main.h"
YSI 0:5d2c38c99ce6 2
YSI 0:5d2c38c99ce6 3 int main(void)
YSI 0:5d2c38c99ce6 4 {
YSI 10:0ab5c8865667 5 while(1) ThisThread::sleep_for(200ms);
YSI 0:5d2c38c99ce6 6 }
YSI 0:5d2c38c99ce6 7
YSI 10:0ab5c8865667 8 string transmission_processing(string cmd)
YSI 0:5d2c38c99ce6 9 {
YSI 4:0e42ea16a9cb 10 ostringstream ssend;
YSI 4:0e42ea16a9cb 11 ssend << fixed;
YSI 4:0e42ea16a9cb 12 ssend.precision(2);
YSI 4:0e42ea16a9cb 13 if(cmd.empty());
YSI 4:0e42ea16a9cb 14 else if(cmd == "*IDN?")
YSI 4:0e42ea16a9cb 15 ssend << MBED_PROJECT << ", Mbed OS " << MBED_VERSION << ", Version dated, " << __DATE__ << ", " << __TIME__;
YSI 9:89dc9f16aa06 16 else if(cmd[cmd.size()-1] == '?')
YSI 9:89dc9f16aa06 17 ssend << "incorrect requeste [" << cmd << "]";
YSI 4:0e42ea16a9cb 18 return ssend.str();
YSI 0:5d2c38c99ce6 19 }