Author Topic: Digix I/O pin madness... (SOLVED, MY BAD)  (Read 1803 times)

exeng

  • Sr. Member
  • ****
  • Posts: 452
Digix I/O pin madness... (SOLVED, MY BAD)
« on: January 11, 2017, 05:45:32 pm »
I'm pulling out my hair...

Using a DigiX for an a project that will require multiple buttons to interact with the system. Using digital pins 44-47 for testing four buttons. Three (call them A, B and C) are simply read for state HIGH or LOW. A fourth is attached to an interrupt (int on HIGH). All are pulled to ground with 10K resistors and buttoned up to 3.3V when pressed. So here is the problem...

Buttons A, B and C always read HIGH. I even wired button A directly to GND and it still read HIGH. The button attached to an interrupt seems to work fine. As far as I know I have not turn on any internal pull-ups, so what am I missing?

It gets weirder if I don't attachInterrupt to the 4th button. In that case, only one of the A,B,C buttons reports HIGH all the time and pressing any or all of them does not change this.

AM I crazy? (Yes but that's a different story). Is there something magic about the DigiX GPIO?

I'll review my handler code again and check my wiring (again). But I guess it's time for an Ardunio UNO baseline again.  Arrgh!

ONE BIG EMBARRASSING EDIT:

All together now to the melody of "Play with Fire" by the Stones... "Well you've got your buttons and you've got your digi pins, And your code is suspect and everybody knows, that you mixed your buttons and you digi pins, so don't do this... anymore... because it's not going to work..."

Basically, my bad. Got tripped up by my own naming conventions and used button values for pin numbers. Dooooh!
« Last Edit: January 11, 2017, 07:49:05 pm by exeng »

PeterF

  • Hero Member
  • *****
  • Posts: 883
Re: Digix I/O pin madness... (SOLVED, MY BAD)
« Reply #1 on: January 12, 2017, 12:31:17 am »
And here I was about to ask if this was you?



Glad you solved the problem... Was worried I'd have to dig out the DigiX again... it has hidden in the cupboard for a while now as I never did work out the perfect project for it...

exeng

  • Sr. Member
  • ****
  • Posts: 452
Re: Digix I/O pin madness... (SOLVED, MY BAD)
« Reply #2 on: January 12, 2017, 09:48:05 am »
Yeah... jumped the gun in my frustration and excitement, and went to the forum for help.  I should know better.  BTW it tripped me up again in another block of logic. That time I was prepared.

That's what happens when you skip code review. Another pet peeve of mine is when you're working with another programmer and he/she says their code is working... it must be yours. Appearances and reality are two different things. In my pro life I would try to break my code in every possible way I could think of before deeming it "working". It's just a hobby now. So, I sometimes take shortcuts.

Sorry for the distraction.