Hi there! My 1st post....
I can read the sensor on D4 properly, also on the A4 with a Uno, but with the MKR 1400 i can not read the sensor on A4, no matter if i call the PIN A4 or 19, the result is always -127.
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS2 4 // 4 works, A4 works not on MKR 1400 but works on Arduino Uno ?!?
OneWire oneWire2(ONE_WIRE_BUS2);
DallasTemperature TEMP1(&oneWire2);
void setup(void)
{
// start serial port
Serial.begin(9600);
TEMP1.begin();
}
void loop(void)
{
Serial.print(" Requesting temperatures...");
TEMP1.requestTemperatures();
Serial.println("DONE");
Serial.println("Temperature is: ");
Serial.println(TEMP1.getTempCByIndex(0));
delay(1000);
}
Any idea what can be wrong?
I have to put 4 seperate temp sensors on A2 to A5, the i/o's of the board are all used.
Is there a difference if i call A2 or 17?
I also tried pinMode(ONE_WIRE_BUS2, INPUT); with no sucess.
The wiring is correct because everything is fine on digital inputs.
Thx a lot