..
Dependencies: ID12RFID TFTLCD mbed
main.cpp
- Committer:
- Danton
- Date:
- 2013-02-01
- Revision:
- 3:cbbfd06fa9b4
- Parent:
- 2:b0edfc6c035a
File content as of revision 3:cbbfd06fa9b4:
#include "mbed.h" #include "ID12RFID.h" #include "hx8340bs.h" ID12RFID rfid(p10); // uart rx HX8340S_LCD lcd( p9, p14, p13, p11 ); //Screen initialization // HX8340S_LCD( PinName CS, PinName RESET, PinName SCL, PinName SDI, PinName BL = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 ); int ReadX(PinName x1, PinName x2, PinName y1, PinName y2){ int tempX; DigitalOut X1(x1); DigitalOut X2(x2); AnalogIn Y1(y1); AnalogIn Y2(y2); X1=1; X2=0; printf("I am set for X\n"); wait(10); printf("I am Measuring X\n"); tempX=Y2; wait(10); return tempX; } int ReadY(PinName x1, PinName x2, PinName y1, PinName y2){ int tempY; DigitalOut X1(X1); DigitalOut X2(X2); AnalogIn Y1(y1); AnalogIn Y2(y2); X1=1; X2=0; tempY=Y1; return tempY; } int main() { printf("Hello World\n"); // initialize display - place it in standard portrait mode and set background to black and // foreground to white color. lcd.Initialize(); lcd.FillScreen(COLOR_RED); lcd.SetBackground(COLOR_BLUE); lcd.DrawRoundRect(20,20,60,60,COLOR_GREEN); // set current font to the smallest 8x12 pixels font. //lcd.SetFont( TerminusFont ); // print something on the screen lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors while(1) { if(rfid.readable()) { printf("RFID Tag number : %d\n", rfid.read()); } if (ReadX(p15,p17,p18,p16)){ printf("X Coordinate : %d\n", ReadX(p15,p17,p18,p16)); } } }