![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
nakagawa kit emurator (add CR) BaudRate 115200,p20
Dependencies: mbed NetServicesMin
main.cpp
- Committer:
- recotana
- Date:
- 2012-03-22
- Revision:
- 0:e5342390978b
- Child:
- 1:495adf710664
File content as of revision 0:e5342390978b:
#include "mbed.h" #include "data_models.h" Serial serial(USBTX, USBRX); DigitalIn din(p20); void serialInit(void){ serial.baud(115200); serial.format(8, Serial::None, 1); } void sendPayload(Payload *data){ uint8_t *d=(uint8_t *)data; for(uint8_t i=0 ; i<68 ; i++){ if(d[i]==0x0A) serial.putc(0x0D); //add LF serial.putc(d[i]); } } int main() { din.mode(PullUp); serialInit(); Payload payload; initTestPayloadData(&payload); payloadToNetwork(&payload); while(1) { if(!din){ sendPayload(&payload); wait(0.2); } } }