![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
LPC
Dependencies: mbed MotorDrivers
main.cpp
- Committer:
- shibazakiwataru
- Date:
- 2020-10-07
- Revision:
- 0:b11edd0d95ed
File content as of revision 0:b11edd0d95ed:
#include "mbed.h" #include "string" RawSerial con(D5,D4,115200); RawSerial pc (USBTX,USBRX,115200); Ticker tras; //Ticker USBtx; string tras_str = ""; string USBtx_str = ""; void atras(){ char con_c = con.getc(); tras_str += con_c; if(con_c == '\n'){ USBtx_str = tras_str; tras_str = ""; } } void aUSBtx(){ con.putc(255); con.putc(255); con.putc(255); con.putc(0b00000000); con.putc('\n'); pc.printf(USBtx_str.c_str()); } int main() { tras.attach(&aUSBtx,0.5); con.attach(&atras,RawSerial::RxIrq); while(1) { } }