Darley Gonzalez
/
serialarray
simple serial array test
Diff: main.cpp
- Revision:
- 0:2786b9d7a210
- Child:
- 1:9a0e9ef94ac6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 28 22:56:19 2015 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" + + + +Serial pc(USBTX, USBRX); // tx, rx + +int j=0; +int x=0; + + +char X_buffer []= {0,0}; + + + +void readSerialString () +{ + j=0; + while(j<=1) { + X_buffer[j] = pc.getc(); + //Serial.println(X_buffer[i]); + j++; + } + +} + + +int main() + +{ + pc.baud(115200); + + while(1) { + readSerialString (); + + + x=atoi(X_buffer); + + pc.printf("%d\n",x); + + } +} \ No newline at end of file