pong game added to the main sketch
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of MainSketch by
Diff: poll.h
- Revision:
- 11:1da15361a35b
- Parent:
- 10:9d9b3b9b28b8
--- a/poll.h Wed May 24 11:21:37 2017 +0000 +++ b/poll.h Wed May 24 13:27:07 2017 +0000 @@ -41,7 +41,7 @@ DigitalOut xp(PTB0); DigitalOut xm(PTB1); - xp = 1; // set positive sdie of x high + xp = 1; // set positive side of x high xm = 0; // dont need to do anyhting to set low side as it should be fine. // but do need to disconnect yp @@ -53,14 +53,14 @@ xv1 += temp1; // get value xv2 += temp2; // get other value delta += abs(temp1 - temp2) / 10; //gets individual differences - // pc.printf("val1 = %d - val2 = %d-diff = %d\n\r",temp1,temp2,temp1-temp2); + // pc.printf("val1 = %d - val2 = %d-diff = %d\n\r",temp1,temp2,temp1-temp2); //observing behaviour when touching / nt touching - + } //delta=abs(xv2-xv1)/10; if(delta < 300) touching = 1; else touching = 0; - pc.printf("delta=%d \t %d\n\r",delta,touching); + //pc.printf("delta=%d \t %d\n\r",delta,touching); xp = 0; xm = 0; return (240 - (240 * ((xv2) / 1 / 10 - 5800)) / 51200); //returns the average of both @@ -100,7 +100,8 @@ -void poll(){ +void poll() +{ int xp,yp = 0; xp=readX(); yp=readY();