Étape 2: programmation
int analogPin = 0 ;
raw int = 0 ;
int Vin = 5 ;
flotteur Vout = 0 ;
float R1 = 10000 ;
float R2 = 0 ;
tampon de flotteur = 0 ;
void setup()
{
Serial.Begin(9600) ;
}
void loop()
{
brut = analogRead(analogPin) ;
if(RAW)
{
tampon = brut * Vin ;
Serial.Print ("raw:") ;
Serial.println(RAW) ;
Serial.Print ("Vout:") ;
Serial.println(Vout) ;
Vout = (tampon) / 1024.0 ;
tampon = (Vin/Vout) -1 ;
Serial.Print ("buf2:") ;
Serial.println(buffer) ;
R2 = R1 * buffer ;
Serial.Print ("Vout:") ;
Serial.println(Vout) ;
Serial.Print ("R2:") ;
Serial.println(R2) ;
Delay(1000) ;
}
}