Hey folks,
Hope everyone is doing good. I would like to reach out to y’all with a tiny bit of help.I am work on project which requires arduino. I am facing difficulty in receiving an output. I tried checking by changing the Arduino UNO, sensor, code as well laptop connected to the arduino. Though no matter what i still get a blank serial monitor/output. The sensors i am using is an ACS712 and LM35. If anyone could help out in any way please do let me know. Looking forward to it.
Could you post your code for us to review please?
surely. here is something i found online and tried.
const int analogIn = A0;
int mVperAmp = 185;
int RawValue= 0;
int ACSoffset = 2500;
double Voltage = 0;
double Amps = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
RawValue = analogRead(analogIn);
Voltage = (RawValue / 1024.0) * 5000;
Amps = ((Voltage - ACSoffset) / mVperAmp);
Serial.print("\t Amps = ");
Serial.println(Amps,3); // the ‘3’ after voltage allows you to display 3 digits after decimal point
delay(2500);
}
As far as I can see, that should work. A simple program to write to serial output is shown in the Arduino reference (https://www.arduino.cc/reference/en/language/functions/communication/serial/println/) and here’s an even simpler version:
int analogValue = 0; // variable to hold the analog value
void setup() {
// open the serial port at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog input on pin 0:
analogValue = analogRead(0);
// print it out in many formats:
Serial.println(analogValue); // print as an ASCII-encoded decimal
// delay 100 milliseconds before the next reading:
delay(100);
}
If you upload that to the Arduino, you should see the serial output in the serial monitor. If you don’t, I would consider checking the port number (although the upload won’t work if you’ve got the wrong port number) and then check the cable.
Are you using the Arduino IDE for this?
Have you tried uploading the “blink” example program to check that the uploads are working?
Yes i Have tried the blink example. I haven’t gotten that output either. I suppose the software is not reading my arduino board. Any way of trouble shooting that?
I almost tried every hack given online.
The blink program doesn’t output to the serial port as far as I know. It should blink the LED on the Arduino though. I asked about that too verify that you are indeed able to upload programs to your Arduino.
Does the Arduino IDE output below the editor indicate success? Could you copy that text for us to see?