Question: Can anyone fix the Arduino uno code?I wanted to write,first measure the input voltage by using voltage sensor.And after that,if its not in the range
Can anyone fix the Arduino uno code?I wanted to write,first measure the input voltage by using voltage sensor.And after that,if its not in the range of 20-22 V,adjust the duty cycle of mosfet in the converter until the voltage becomes in the range 20-22 V.
int analogInput = 10; #define PWM_out 6 float vout = 0.0; float vin= 0.0; float R1 = 30000.0; float R2 = 7500.0; int value = 0; int pwm_value = 0; void setup() { pinMode (analogInput, INPUT); Serial.begin (9600); Serial.println("BASIC DC VOLTMETER"); } void loop() { value = analogRead (analogInput); vout (value + 5.0) / 1024.0; vin = vout / (R2 / (R1+R2)); "); Serial.println(vin, 2); Serial.print("Voltage delay(500); if (vin > 20.0 && 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
