Hi,
Thanks for your answers but I managed to solve it off by doing:
void setup() {
Serial.begin(9600);
pinMode(A1,INPUT_PULLUP);
digitalWrite(A1, HIGH);
}
void loop() {
int sensorValue = analogRead(A1);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.print('T');
}
I was reading the documentation @
and found:
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pull-up on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor. See the digital pins tutorial for more information.
So now It works as expected. However I have a new problem which I have posted in the "programming questions ", the new problem gist is of using pins to establish a SERIAL_UART connection between raspberry pi3 b+ and Arduino and sending these values to the raspberry pi 3 b+.