pong game added to the main sketch
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of MainSketch by
Diff: slider.h
- Revision:
- 10:9d9b3b9b28b8
- Child:
- 11:1da15361a35b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slider.h Wed May 24 11:21:37 2017 +0000 @@ -0,0 +1,22 @@ +#include "tsi_sensor.h" +#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) + #define ELEC0 9 + #define ELEC1 10 +#elif defined (TARGET_KL05Z) + #define ELEC0 9 + #define ELEC1 8 +#else + #error TARGET NOT DEFINED +#endif +float tsi_current, tsi_last = 0; + +float tsi_d(){ + TSIAnalogSlider tsi(ELEC0, ELEC1, 40); + tsi_current = tsi.readPercentage(); + float delta = 0; + if (tsi_current != 0 && tsi_last != 0) delta = tsi_current - tsi_last; + else delta = 0; + tsi_last = tsi_current; + return delta; +} + \ No newline at end of file