takumi funada
/
LCD
testing TextLCD and SD card
main.cpp@0:cc883de36463, 2010-07-01 (annotated)
- Committer:
- funax
- Date:
- Thu Jul 01 18:01:20 2010 +0000
- Revision:
- 0:cc883de36463
- Child:
- 1:60d8589343b6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
funax | 0:cc883de36463 | 1 | #include "mbed.h" |
funax | 0:cc883de36463 | 2 | #include "TextLCD.h" |
funax | 0:cc883de36463 | 3 | |
funax | 0:cc883de36463 | 4 | TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3 |
funax | 0:cc883de36463 | 5 | |
funax | 0:cc883de36463 | 6 | #include "SDFileSystem.h" |
funax | 0:cc883de36463 | 7 | |
funax | 0:cc883de36463 | 8 | SDFileSystem sd(p5, p6, p7, p13, "sd"); |
funax | 0:cc883de36463 | 9 | |
funax | 0:cc883de36463 | 10 | |
funax | 0:cc883de36463 | 11 | int main() { |
funax | 0:cc883de36463 | 12 | lcd.printf("Hello World!!"); |
funax | 0:cc883de36463 | 13 | lcd.locate(0, 1); |
funax | 0:cc883de36463 | 14 | |
funax | 0:cc883de36463 | 15 | |
funax | 0:cc883de36463 | 16 | printf("checking SD\n"); |
funax | 0:cc883de36463 | 17 | |
funax | 0:cc883de36463 | 18 | FILE *fp = fopen("/sd/foo.txt", "w"); |
funax | 0:cc883de36463 | 19 | if(fp == NULL) { |
funax | 0:cc883de36463 | 20 | error("Could not open file for write\n"); |
funax | 0:cc883de36463 | 21 | } |
funax | 0:cc883de36463 | 22 | fprintf(fp, "Hello SD Card World!!"); |
funax | 0:cc883de36463 | 23 | fclose(fp); |
funax | 0:cc883de36463 | 24 | |
funax | 0:cc883de36463 | 25 | lcd.printf("Sayonara World!!"); |
funax | 0:cc883de36463 | 26 | |
funax | 0:cc883de36463 | 27 | |
funax | 0:cc883de36463 | 28 | } |