I'm try to read the state of each switch on a DIP switch.
void setup(){
pinMode(19, INPUT); // Set pin to input
pinMode(18, INPUT); // Set pin to input
pinMode(15, INPUT); // Set pin to input
digitalWrite(19,HIGH); // enable internal pull-up
digitalWrite(18,HIGH); // enable internal pull-up
digitalWrite(15,HIGH); // enable internal pull-up
if (digitalRead(19)==LOW)
volumeCtrlLocked=true;
else volumeCtrlLocked=false;
if (digitalRead(18)==LOW)
outputLocked=true;
else outputLocked=false;
if (digitalRead(15)==LOW)
phaseLocked=true;
else phaseLocked=false;
}
The digitalRead on pins 24 (D18) and 25 (D19) always returns LOW for some reason. D15 responds as expected, it only returns LOW when the switch is closed.
It also works fine when I connect the DIP switch to some other digital pins, instead of D18 and D19.
I'm using the Sanguino software and upload the code using an Uno. At first I thought that it might have something to do with the JTAG interface being enabled, but the problem still occurs after disabling it by setting the fuses.
The reason that I want to use this pins is that I have a PCB that connects the DIP switch to these pins, so using other pins in no real option for me.
I must be missing something here...
EDIT: I attached the boards.txt file with the settings of the fuses and other settings as well.
At first I thought that it might have something to do with the JTAG interface being enabled, but the problem still occurs after disabling it by setting the fuses.
this seems like a likely theory. Are you sure you have the fuse settings correct for disabled JTAG?
At first I thought that it might have something to do with the JTAG interface being enabled, but the problem still occurs after disabling it by setting the fuses.
this seems like a likely theory. Are you sure you have the fuse settings correct for disabled JTAG?
I´m a beginner, so I might have the fuses set wrongly to disable JTAG.