I am running external mode on arduino mega and the analog inputs are always high. What is wrong in my settings?

1 view (last 30 days)
I am trying to run external mode and read an Analog Input on an Arduino Mega. I always see the input set to high (5) no mater what my actual voltage is. I just convert the analog input to read between 0-5V (5/1023), but there is no other response. It's always stuch in high. All Analog outputs are working properly, but I cannot fix my input readings. Is there a setting that I have to change? What am I doing wrong? TIA

Answers (1)

Ayush
Ayush on 26 Jul 2024
Edited: Ayush on 26 Jul 2024
Hi Christos,
I understand that you are trying to run external mode and read an Analog Input on an Arduino Mega but are facing issues where the input always reads high (5V) regardless of the actual voltage.
Here are some workarounds and steps you can try for troubleshooting the issue:
  1. Verify Connections and Pin Usage: Ensure your sensor or voltage source is properly connected and you are reading from the correct analog pin. Since the Arduino Mega has multiple analog pins (A0 to A15), it's important to use the correct pin number in your code.
  2. Test with a Known Voltage Source: Create a stable voltage source, such as a 2.5V reference, and connect it to the analog input pin. This can help you verify that the pin is capable of reading different voltage levels.You can create a 2.5V source using a voltage divider circuit with two equal resistors (e.g., two 10kΩ resistors in series between 5V and GND).
If the workaround above didn't help, please provide the code you are using. This will help in identifying any potential issues in the code itself.
Hope this helps!
Regards

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!