float detect_appui(unsigned long temps)
{
static unsigned long t_appui = 0;
if (digitalRead(8) == 0)
{
t_appui = temps;
}
return t_appui;
}
float conversion(float temps2)
{
static float reponse = 0 ;
reponse = temps2 / 1000;
return reponse;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(3, OUTPUT);
pinMode(8, INPUT_PULLUP);
}
void loop()
{
unsigned long t_appui;
float reponse;
unsigned long t_ms = millis();
t_appui = detect_appui(t_ms);
/*Serial.println(t_appui);*/
reponse = conversion(t_appui);
Serial.print("le temps est");
Serial.print (" ");
Serial.println(reponse);
}