pong game added to the main sketch

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of MainSketch by IoT Ox

slider.h

Committer:
Owenmatthewmcgowan
Date:
2017-05-24
Revision:
13:50289d0ac834
Parent:
11:1da15361a35b

File content as of revision 13:50289d0ac834:

#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;
}