Dependencies: FatFileSystem TextLCD mbed SDFileSystem
main.cpp
- Committer:
- esmiwa
- Date:
- 2012-06-17
- Revision:
- 0:e5b31a08eab0
File content as of revision 0:e5b31a08eab0:
/* XBee Test_5 */ /*Mbed_you- 40704B01 ROUTER AT*/ /*Mbed_me - 406F4E57 COODINATOR AT*/ #include "mbed.h" #include "TextLCD.h" #include "SDFileSystem.h" Serial xbee(p13, p14); TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7 SDFileSystem sd(p5,p6,p7,p8,"sd"); BusOut led(LED1,LED2,LED3,LED4); InterruptIn tact(p22); int main() { int c1,c2,c3; int counter=0; FILE *fp= fopen("/sd/data.txt", "w"); led = 0; lcd.printf("Hello! conter"); while (1) { if (xbee.readable()) { led=1; c1=xbee.getc(); c2=xbee.getc(); c3=xbee.getc(); lcd.locate(0,1);lcd.printf("%d%d%d",c1,c2,c3); fprintf(fp, "%d%d%d\n",c1,c2,c3); counter++; } led=0; if(counter>=100)break; } fclose(fp); lcd.printf("end"); }