Bonjour,
j ai créé grâce a l arduino un voltmètre qui mesure jusque 30 v grâce a un pont diviseur de tension mais petit problème quand j affiche sur mon écran lcd I2C de 0 à 9v sa affiche correctement mais plus haut le chiffre de l unité disparaît vous pouvez m'aider
voici mon code :
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
int analogInput = 0;
float vout =0.0;
float vin = 0.0;
float R1 = 100000.; // resistance of R1 (100K) -see text!
float R2 = 10000.0; // resistance of R2 (10K) - see text!
int value = 000;
void setup(){
pinMode(analogInput, INPUT);
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop(){
// read the value at analog input
value = analogRead(analogInput);
vout = (value * 005.00) / 1024.00; // see text
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=000.0;//statement to quash undesired reading !
}
lcd.clear();
lcd.setCursor(2,4);
lcd.print(vin);
delay(500);
Serial.println(vin);
}
PS:désoler pour toutes les fautes d orthographe