..
Dependencies: ID12RFID TFTLCD mbed
Diff: main.cpp
- Revision:
- 2:b0edfc6c035a
- Parent:
- 0:1a4b667a7f2a
- Child:
- 3:cbbfd06fa9b4
--- a/main.cpp Fri Feb 01 15:25:18 2013 +0000 +++ b/main.cpp Fri Feb 01 17:46:41 2013 +0000 @@ -2,9 +2,40 @@ #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; + tempX=Y2; + + 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() { @@ -12,9 +43,9 @@ // initialize display - place it in standard portrait mode and set background to black and // foreground to white color. lcd.Initialize(); - lcd.FillScreen(COLOR_CYAN); + lcd.FillScreen(COLOR_RED); lcd.SetBackground(COLOR_BLUE); - lcd.DrawRoundRect(20,20,60,60,COLOR_RED); + 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 @@ -24,5 +55,16 @@ 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)); + } } -} \ No newline at end of file +} + + + + + + + + \ No newline at end of file