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

조회 수: 1 (최근 30일)
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

답변 (1개)

Ayush
Ayush 2024년 7월 26일
편집: Ayush 2024년 7월 26일
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

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by