Question: Arduino Uno.How can i write this algorithm? 1) Declaration 2) setup of inputs 3) measure voltage(with arduino voltage sensor) 4) if its not in the
int analogInput = Al; // I used Al #define PWM_out 6 float vout = 0.0; float vin = 0.0; float R1 = 30000.0; //30k float R2 = 7500.0; //7500 ohm resistor, I tweaked this int value = 0; int pwm_value = 0; void setup() { pinMode (analogInput, INPUT); Serial.begin(9600); Serial.println("BASIC DC VOLTMETER"); } void loop() { // read the value at analog input value = analogRead (analogInput); vout = (value * 5.0) / 1024.0; vin = vout / (R2/ (R1+R2)); Serial.print("Voltage = "); Serial.println(vin, 2); delay(500); 1 if (vin > 20.0 && vin
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
