I am stuck with what has happened.
Back story:
I am (again) working on a project.
It has 1 input, and quite a few outputs and an RTC.
It was working - kind of - and had a problem where the button wasn’t always “seen” when I pressed it and so sometimes the program hung if I was doing certain things.
After weeks, I asked for help and was shown a few of my mistakes - hardware wise.
The main circuit is 12 v. But now and then the Arduino regulator would get HOT for reasons - at that time - unknown.
To avert this, I put a 7805 before the Arduino and fed the 5 volts into the 2.1mm connector.
It worked. (Don’t ask how. I don’t know either.)
But the person who helped me showed me the Arduino was running on about 3.5 volts, not 5.
Though this was a good thing to learn, it is weird, as I had measured 4.x volts on some of the outputs while testing.
But anyway…
The 7805 was removed and I fed the 12v into the 2.1 mm jack and things were looking … good/better.
There were 4 pins used to output BCD to a display and it was not working “correctly” until then. The lower left segment was always on when displaying digits. So 2 and 3 were hard to distinguish.
Alas the 12v supply didn’t fix the problem.
Story:
There are 5 relays powered from 12v.
If any of them are active, a pump is activated too.
The pump pulls about 1.5A and a relay/load… < 1A.
It is a 5A supply.
All things plugged in, etc:
I click the button the sketch would run and do the “main function” ok.
Even clicking during the sketch the button was detected.
However, if I went into the added sub-menus, the button would not be seen/detected.
If I removed the pump, it would work ok. So it was thought to be noise.
I tried .09 and .47u caps across the motor to no avail - at the 3.5 volt stage.
By the time I got to the 5 volt stage, the sketch stopped working, so I never really got to test that.
If I unplugged the Arduino and sort of tested the inputs, they didn’t seem to have any problems, so I thought it may be something to do with the Arduino. But it was brand new.
I got the leads and pulled them all low, and then went through and put them high - one at a time - I say the correct digits on the display, so I am guessing that means “All good”. No Arduino in the circuit at this point, of course.
I re-assigned the pins and tried again.
I think that is when it all started to go wrong.
The sketch wouldn’t work any more.
I would click the button and nothing would happen.
I put the pins back to their original numbers, moved the plugs on the pins to their “old” positions and tried again.
On boot, the outputs were spiked high, then low for no reason.
Huh?
Adding a bit of code, I discovered the input pin was seeing a button press which wasn’t happening, AND wouldn’t respond to any more button presses.
I put the pins to the “new” assignments and re-plugged the pins to the new positions. Same.
To check I wasn’t going batty, I got a CLICK-BUTTON test sketch and tried it with NOTHING ELSE connected to the Arduino.
The LED wouldn’t change when I clicked the button.
(Yes, I had to edit the pins used for the LED and input.)
I tried this on the other pin to the same result.
But to add insult to injury, if I used ANOTHER input pin, it WOULD work.
It would SEEM that the two pins I used/assigned for the input and did the set up for Click button to PULL_UP, etc are now kaput.
But I can’t see how, or what I did to them.
As all the other pins are outputs, and they are going to drive transistor/drivers there would be no feedback to zap them.
As far as I can see, they work ok as outputs, but they are “stuck” LOW if acting as inputs.
Can anyone help me better understand the “problem”?