Darley Gonzalez
/
serialarray
simple serial array test
main.cpp
- Committer:
- pedro_C
- Date:
- 2015-05-28
- Revision:
- 1:9a0e9ef94ac6
- Parent:
- 0:2786b9d7a210
File content as of revision 1:9a0e9ef94ac6:
#include "mbed.h" Serial pc(USBTX, USBRX); // tx, rx int j=0; int x=0; char X_buffer []= {0,0}; //2 item array void readSerialString () { j=0; while(j<=1) { X_buffer[j] = pc.getc(); j++; } } int main() { pc.baud(115200); while(1) { readSerialString (); x=atoi(X_buffer); //convert to int pc.printf("%d\n",x); } }