So for my first arduino project i bought an inclination sensor.
The output is 0,5 to 4,5 V, so it should be readable for the analog pins without using a Voltage divider. The problem is that the arduino reads values that are extremly inconsistant and moving the sensor has
no effect at all.
So my questions are:
Do I need any pulldown resistors or anything like that or can I connect the output of the sensor directly to an analog pin?
2.is the sensor maybe not working correctly?
this is my first project so please dont mind if I have forgotten anything or done smth stupid
So I tried with a multimeter and it worked, and it worked fine. But still not on the arduino.
Heres the code:
int analogPin = 0; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read
void setup()
{
Serial.begin(9600); // setup serial
}
void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
its just copied from the arduino page, bc i wanted to see if the problem is in the code or not.
Wiring:
Output of the sensor connected to A0
arduino is powered via usb
sensor is powered by an external 10V power supply.