//creditos ao canal WR Kits
#include <LiquidCrystal.h>
#define charge 12
#define discharge 11
#define resistor 2150.0F
#define capLoad A0
LiquidCrystal disp(8,
9,
4,
5,
6,
7);
unsigned long Time01;
unsigned long Time02;
float microFarads;
float nanoFarads;
void setup()
{
pinMode(charge, OUTPUT);
digitalWrite(charge, LOW);
disp.begin(16, 2);
disp.setCursor(2,0);
disp.print("Capacimetro");
}
void loop()
{
digitalWrite(charge, HIGH);
Time01 = millis();
while(analogRead(capLoad) < 648){ }
Time02 = millis() - Time01;
microFarads = ((float)Time02 / resistor) * 1000;
if (microFarads > 1)
{
disp.setCursor(5,1);
disp.print((long)microFarads);
disp.print(" uF");
}
else
{
nanoFarads = microFarads * 1000.0;
disp.setCursor(5,1);
disp.print((long)nanoFarads);
disp.print(" nF");
}
digitalWrite(charge, LOW);
pinMode(discharge, OUTPUT);
digitalWrite(discharge, LOW);
while(analogRead(capLoad) > 0){ }
pinMode(discharge, INPUT);
delay(300);
}
Onde compro este material
Cadê o vídeo ?