#include <CapacitiveSensor.h>

const int EVBuse = 8;
CapacitiveSensor capSenseBPBuse = CapacitiveSensor(11,12);
CapacitiveSensor capSenseATGen = CapacitiveSensor(11,13);
bool etatBPBuse = false;
int long onOffBPBuse = 0;
int long ATGen = 0;
byte autorisationBuse = 0;
byte etatPrecedentBPBuse = 0;
byte allumageBuse = 0;


void setup() {
  pinMode(EVBuse, OUTPUT);
  digitalWrite(EVBuse, LOW);
  Serial.begin(115200);
}

void loop() {
  int seuil = 200;
  onOffBPBuse = capSenseBPBuse.capacitiveSensor(30); 
  if(onOffBPBuse > seuil){
    etatBPBuse = true;
  }
    else{
      etatBPBuse = false;
    }
  delay(1);

  if(etatBPBuse != etatPrecedentBPBuse){
    if(etatBPBuse == true){
      allumageBuse = !allumageBuse;
    }
    if(allumageBuse == 1){
      digitalWrite (EVBuse, HIGH);
    }
      else{
        digitalWrite (EVBuse, LOW);
      }
  }
  etatPrecedentBPBuse = etatBPBuse;

  ATGen = capSenseATGen.capacitiveSensor(30); 
  if(ATGen > seuil){
    digitalWrite (EVBuse, LOW);
  }
}
$abcdeabcde151015202530fghijfghij