I need one arduino uno two acs712 binding codes
Hello ayhancan65
This is a nice project to get started.
Follow the example code that comes with the library or
run some tutorials for the hardware selected.
If you are happy with the results of the tutorials you can merge these to your project.
Have a nice day and enjoy coding in C++.
The mission of this forum is to help with arduino project problems, not to develop code.
But there is a topic category you can use:
" https://forum.arduino.cc/c/community/jobs/42 to pay for your code development.
They already duplicate posted there.
https://forum.arduino.cc/t/acs712-please-help/1152955
What is a binding code?
Thanks for your reply
My actual code is below. I want to connect a second acs712 to this code So I want to use two acs712s
int analogPin = A1;
const int averageValue = 500;
long int sensorValue = 0;
float voltage = 0;
float current = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
for (int i = 0; i < averageValue; i++)
{
sensorValue += analogRead(analogPin);
delay(2);
}
sensorValue = sensorValue / averageValue;
voltage = sensorValue * 5.0 / 1024.0;
current = (voltage - 2.5) / 0.185;
Serial.print("ADC Value: ");
Serial.print(sensorValue);
Serial.print(" ADC Voltage: ");
Serial.print(voltage);
Serial.print("V");
Serial.print(" Current: ");
Serial.print(current);
Serial.println("A");
}
Just add it to e.g A2 ?
I tried but this time it gives the below error
error: redefinition of 'int analogPin'
int analogPin = A2;
^~~~~~~~~
C:\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\sketch_jul18c_copy_20230718150914.ino:9:6: note: 'int analogPin' previously defined here
int analogPin = A0;
^~~~~~~~~
Compilation error: redefinition of 'int analogPin'
I suggest you read the beginners programming tutorial ... or, as you are in the "payed" subsection, do you want to spend money on it?
Unfortunately, if I had no money, I would gladly help this forum site.
Well, then work through the programming tutorials. You need to understand the basics, then it'll go easy.
I have merged your cross-posts @ayhancan65.
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
Please edit the code in your post, to enclose it in code tags, as outlined in the forum introductory guide:
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.