Hello
Am having difficult figure out how to properly code my arduino uno.
am just going to briefly explain what am trying to do. i have roughly two set of data points which are current values and duty cycle that are associated with the current values below are those values:
"Current Value"
0.526
0.586
0.661
0.751
0.766
0.886
1.066
1.321
1.771
2.656
"Duty cycle"
53.5%
53.8%
54.1%
54.5%
54.6%
55.1%
55.8%
56.7%
58.3%
61.5%
for example current value .526 amps goes with duty cycle 53.5% and these 10 data point are what i will be using the acs712 current sensor to compare the values to.
now what i need help with is i need to be able to read the current every half second lets say, and compare those current values that are coming in to the 10 values that i have listed above after it finds approx the right value i want it then to send the appropate duty cycle to a specified pin on the arduino, i want this to happen continually.
Please if you could prove me with this code that will do this task or help me out that will be great, i really tried but am not able to get it going, this is what i have so far only code for sensor.
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println((514sensorValue)*27.03/1023);
delay(350);
}
Thank you so much