Heute Vormittag ging es nur per Foto… nun aber noch als Text:
byte mp3MaxVolume = 30; // maximal volume of DFPlayer Mini
byte potilock; // Potilock DATA (0-1)
int PotiPin = 7; // 10kOhm Poti at Pin A7
int PotiHysterese = 2; // Volumenpoti Hysterese (Standarteinstellung = 2)
int PotiValue; // Poti Value now, Volumen
int oldPotiValue; // old Poti Value, Volumen
//im Loop:
PotiValue = analogRead(PotiPin);
PotiValue = map(PotiValue,0,1024,0,mp3MaxVolume);
// Vergleiche aktueller Lautstärke-Potistellung mit der alten Stellung inkl. Hysterese
if (PotiValue > oldPotiValue + PotiHysterese || PotiValue < oldPotiValue - PotiHysterese)
{if(potilock == 0)
{Serial.print(F("mp3 | Volumen: "));Serial.println(PotiValue);
mp3.setVolume(PotiValue);
oldPotiValue = PotiValue;}}