Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of IM920_sample by
main.cpp
- Committer:
- okini3939
- Date:
- 2014-12-26
- Revision:
- 0:512667e240df
- Child:
- 1:0deed3031dfc
File content as of revision 0:512667e240df:
#include "mbed.h" #include "IM920.h" DigitalOut myled(LED1); Serial pc(USBTX, USBRX); IM920 im920(p28, p27, p29); void callback () { int i; char buf[65]; i = im920.recv(buf, 64); buf[i] = 0; printf("recv: '%s' (%d)\r\n", buf, i); } int main() { int i = 0; char buf[65]; pc.baud(115200); pc.printf("*** IM920\r\n"); im920.init(10, callback); myled = 1; for (;;) { im920.poll(); if (pc.readable()) { char c = pc.getc(); if (c == '\r') { buf[i] = 0; printf("send: %s\r\n", buf); im920.send(buf, i); i = 0; } else if (i < 64) { buf[i] = c; i ++; } } } }