#include <HCSR04.h>
const byte triggerPin = A1;
const byte echoPin = A0;
UltraSonicDistanceSensor distanceSensor(triggerPin, echoPin);
const int pinButton = A2;
const int rougePin=A6;
const int jaunePin=A4;
const int vertPin=A5;
const int buzzerPin=A3;
void setup() {
  Serial.begin(115200);
  pinMode(triggerPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(pinButton, INPUT);
  pinMode(rougePin, OUTPUT);
  pinMode(jaunePin, OUTPUT);
  pinMode(vertPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  if (digitalRead(pinButton) == HIGH) {
    float distance = distanceSensor.measureDistanceCm();
    Serial.println(distance);
    if(distance<30){
      digitalWrite(rougePin, HIGH);
      digitalWrite(jaunePin, LOW);
      digitalWrite(vertPin, LOW);
      tone(buzzerPin, 4000);}
    else if(distance>=30 && distance<=120){
      digitalWrite(rougePin, LOW);
      digitalWrite(jaunePin, HIGH);
      digitalWrite(vertPin, LOW);
      tone(buzzerPin, 400);}
    else if(distance>120){
      digitalWrite(rougePin, LOW);
      digitalWrite(jaunePin, LOW);
      digitalWrite(vertPin, HIGH);
      noTone(buzzerPin);
       }
  }
  delay(1000);
}





  
  
$abcdeabcde151015202530354045505560fghijfghij