Hello,
I've been looking for a solution on this one but did not see anyone having this (exact) problem - only similar problems but not comparable.
Using Arduino Uno (or Nano - both show the same behaviour) I have the following phenomenon:
I am using 4 digital inputs (D2 to D5)
Configured as INPUT_PULLUP so internal resistors are used and I can directly connect GND and D2-5
to create a signal (according to documentation when using INPUT_PULLUP then LOW=ON, HIGH=OFF)
So far nothing special...
Now, when I create a signal on D2 and D3 in short time distances (by directly putting together the cables GND-D2 resp. GND-D3 - no external instruments or sensors used!!) I sometimes get a LOW value on D4 or D5 as if I had created a signal on those pins. But they are isolated! Nothing at all is connected to them!
I can see this happen on the serial monitor of the IDE by the serial.print commands I added in the appropriate IF sections. So I expected to see only lines like
TAZnew1234.56 or TBZnew2345.67 from D2 and D3. But sometime I also get
TAS1234.56 or TBS2345.67 from D4 and D5
Here is the simple code snippet:
void setup() {
//=================
pinMode(1,OUTPUT);
pinMode(2,INPUT_PULLUP); //TAZ
pinMode(3,INPUT_PULLUP); //TBZ
pinMode(4,INPUT_PULLUP); //TAS
pinMode(5,INPUT_PULLUP); //TBS
pinMode(6,OUTPUT); // reserved
pinMode(7,OUTPUT); // reserved
pinMode(8,OUTPUT); //reserved RED F1
pinMode(9,OUTPUT); //reserved RED F1
pinMode(10,OUTPUT); // LED1
pinMode(11,OUTPUT); // LED2
pinMode(12,OUTPUT); // LED3
pinMode(13,OUTPUT); //onboard LED
//==================
digitalWrite(1,LOW);
//digitalWrite(2,LOW);
//digitalWrite(3,LOW);
//digitalWrite(4,LOW);
//digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW); //red
digitalWrite(11,LOW); //yellow
digitalWrite(12,LOW); //green
digitalWrite(13,LOW);
//======================
}
void loop() {
if (digitalRead(2)== LOW){
TAZnew = millis();
Serial.print("TAZnew");
Serial.println(TAZnew);
//some more code...
}
if (digitalRead(3)== LOW){
TBZnew = millis();
Serial.print("TBZnew");
Serial.println(TBZnew);
//some more code...
}
if (digitalRead(4)== LOW){
TASnew = millis();
Serial.print("TAS");
Serial.println(TASnew);
//some more code...
}
if (digitalRead(5)== LOW){
TBSnew = millis();
Serial.print("TBS");
Serial.println(TBSnew);
//some more code...
}
}
===================================================
anyone got any idea why or how this happens?
It really messes up the whole system of measuring...
Any comments are appreciated.