pong game added to the main sketch

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of MainSketch by IoT Ox

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers slider.h Source File

slider.h

00001 #include "tsi_sensor.h"
00002 #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
00003 #define ELEC0 9
00004 #define ELEC1 10
00005 #elif defined (TARGET_KL05Z)
00006 #define ELEC0 9
00007 #define ELEC1 8
00008 #else
00009 #error TARGET NOT DEFINED
00010 #endif
00011 float tsi_current, tsi_last = 0;
00012 
00013 float tsi_d()
00014 {
00015     TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
00016     tsi_current = tsi.readPercentage();
00017     float delta = 0;
00018     if (tsi_current != 0 && tsi_last != 0) delta = tsi_current - tsi_last;
00019     else delta = 0;
00020     tsi_last = tsi_current;
00021     return delta;
00022 }