![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
remote control
Dependencies: mbed BufferedSerial drorfilter
Revision 0:2d9632685074, committed 2020-05-02
- Comitter:
- drorbalbul
- Date:
- Sat May 02 10:50:51 2020 +0000
- Commit message:
- remote control
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BufferedSerial.lib Sat May 02 10:50:51 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/sam_grove/code/BufferedSerial/#7e5e866edd3d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drorfilter.lib Sat May 02 10:50:51 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/drorbalbul/code/drorfilter/#79c3c9652970
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat May 02 10:50:51 2020 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "Filter.hpp" +#include "BufferedSerial.h" +//------------------------------------ +// Hyperterminal configuration +// 9600 bauds, 8-bit data, no parity +//------------------------------------ + +BufferedSerial pc(SERIAL_TX, SERIAL_RX); +BufferedSerial xbee(PA_9, PA_10); +DigitalOut myled(LED1); +char read_data[3] = {0,0,0}; +int num = 0; +Filter wfilter(0.8, 0); +unsigned long long numRx = 0; +int main() +{ + pc.baud(57600); + xbee.baud(57600); + int numRx; + while(1) { + numRx = 0; + int numchar = 3; + if (xbee.readable()){ + int count=0; + while(numchar!=count) { + if(xbee.readable()) { + read_data[count] = xbee.getc()-48; + count++; + } + } + numRx = (read_data[0] * 100) + (read_data[1] * 10) + (read_data[2]); + pc.printf("the num is %d ", numRx); + pc.printf("the filterd num is %.4f", wfilter.Applyfilter(numRx)); + + } + else{ + pc.printf("NO DATA\r\n"); + } + wait(1); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat May 02 10:50:51 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file