Étape 2 :
C’est le code profiter. les entrées analogiques utilisées sont A2 et A4VU-mètre par theredstonelabz et michiel H n’oubliez pas aimer et de s’abonner pour soutenir mon travail. tnx
#include < LiquidCrystal.h >
speciale caractères
p3 octet [8] = {}
B11111,
B00000,
B10000,
B10000,
B10000,
B10000,
B00000,
B11111
};
p4 octet [8] = {}
B11111,
B00000,
B11000,
B11000,
B11000,
B11000,
B00000,
B11111
};
p5 octet [8] = {}
B11111,
B00000,
B11100,
B11100,
B11100,
B11100,
B00000,
B11111
};
octet p6 [8] = {}
B11111,
B00000,
B11110,
B11110,
B11110,
B11110,
B00000,
B11111
};
p7 octet [8] = {}
B11111,
B00000,
B11111,
B11111,
B11111,
B11111,
B00000,
B11111
};
octet L [8] = {}
B11111,
B00000,
B11111,
B10000,
B10000,
B10000,
B00000,
B11111
};
Byte R [8] = {}
B11111,
B00000,
B11111,
B00101,
B00101,
B11010,
B00000,
B11111
};
octet K [8] = {}
B11100,
B11110,
B11111,
B11111,
B11111,
B11111,
B11110,
B11100
};
octet LEEG [8] = {}
B11111,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B11111
};
leftChannel int = 0 ; entrée de canal Linker
int rightChannel = 0 ; rechter kanaal entrée
int gauche, droit, left2, right2 ; variabelen
const int numReadings = 3 ; 5 données voor de lezingen
int lectures [numReadings] ; aantal lezingen
int index = 0 ; index van de momentele lezing
total int = 0 ; totaal op nul zetten
maxi int = 0 ;
index2 int = 0 ; index van de momentele lezing (2)
total2 int = 0 ; Hoogste getal dans de lezingen
maxi2 int = 0 ;
inputPin int = A2 ; Liens ingangspin
int inputPin2 = A4 ; ingangspin rechts
volL int = 0 ;
volR int = 0 ;
int carL = 0 ;
carR int = 0 ;
priscilia int ;
int vul2 ;
laad int ;
Innovente lcd (12, 11, 5, 4, 3, 2) ; configuratie LCD
void setup() {}
Serial.Begin(9600) ;
LCD.Begin (16, 2) ; bepaling grootte van de lcd
pour (int thisReading = 0; thisReading < numReadings ; thisReading ++)
lectures [thisReading] = 0 ;
lcd.createChar (1, p3) ;
lcd.createChar (2, p4) ;
lcd.createChar (3, p5) ;
lcd.createChar (4, p6) ;
lcd.createChar (5, p7) ;
lcd.createChar (6 L) ;
lcd.createChar (7, R) ;
lcd.createChar (8 K) ;
lcd.createChar (9, LEEG) ;
pour (priscilia = 0; priscilia < 80 ; priscilia ++)
{
pour (laad = 0; laad < priscilia/5 ; laad ++)
{
lcd.setCursor (laad, 1) ;
LCD.Write(5) ;
}
if(LAAD<1)
{
lcd.setCursor (0, 1) ;
LCD.Write(5) ;
}
lcd.setCursor (laad + 1, 1) ;
LCD.Write((vul-vul/5*5)+1) ;
pour (laad = laad + 2; laad < 16 ; laad ++)
{
lcd.setCursor (laad, 1) ;
LCD.Write(9) ;
}
lcd.setCursor (0, 0) ;
LCD.Print("Loading...") ;
Delay(50) ;
}
LCD.Clear() ;
Delay(500) ;
}
void loop()
{
lcd.setCursor (0, 0) ; L fr R worden op het scherm gezet
LCD.Write(6) ;
lcd.setCursor (0, 1) ;
LCD.Write(7) ;
lcd.setCursor (15, 0) ; kapjes worden op het scherm gezet
LCD.Write(8) ;
lcd.setCursor (15, 1) ;
LCD.Write(8) ;
Total=analogRead(inputPin) ;
if(total > maxi)
{
Maxi = total ;
}
index ++ ;
Si (index > = numReadings) //Na 5 lezingen gaan nous naar 0
{
index = 0 ;
gauche = maxi ;
Maxi = 0 ;
}
Total2=analogRead(inputPin2) ;
if(Total2 > maxi2)
{
maxi2 = total2 ;
}
index2 ++ ;
Si (index2 > = numReadings) //Na 5 lezingen gaan nous naar 0
{
index2 = 0 ;
droite = maxi2 ;
maxi2 = 0 ;
}
volR = droit/3 ;
if(volR>14)
{
volR = 14 ;
}
pour (priscilia = 0; priscilia < volR ; priscilia ++)
{
lcd.setCursor (priscilia + 1, 1) ;
LCD.Write(5) ;
}
pour (priscilia = volR + 1; priscilia < 15 ; priscilia ++)
{
lcd.setCursor (priscilia, 1) ;
LCD.Write(9) ;
}
volL = gauche/3 ;
if(volL>14)
{
volL = 14 ;
}
pour (vul2 = 0; vul2 < volL ; vul2 ++)
{
lcd.setCursor (vul2 + 1, 0) ;
LCD.Write(5) ;
}
pour (vul2 = volL + 1; vul2 < 15 ; vul2 ++)
{
lcd.setCursor (vul2, 0) ;
LCD.Write(9) ;
}
Serial.println(Left) ;
}