Quantcast
Channel: fritzing forum - Latest posts
Viewing all articles
Browse latest Browse all 28182

Is it possible perhaps a Daft question

$
0
0

I expect that he used normally closed push buttons (rather than the more usual normally open that my schematic used and you appear to have). The easiest fix is to replace the HIGH in the code above with LOW as below:

// if a turnout is NOT in motion, check to see if its button is pressed
int button_state = digitalRead(turnouts[i].data.button_pin);
if(button_state == LOW){
// toggle position

which should make your button work without changes. You would need to change the push buttons you have with one that is normally open (or change to the NC connection if your push button has both) to make the change in the circuit and the software change is easier and cheaper I expect. Your common cathode leds should work if you change the common point from +5V to ground. I think that HC cmos should drive either direction (although I can't say that I've tried it) and you may need to change some constants in the code to get the leds to light in the expected manner but that may be faster than waiting for new leds from ebay :slight_smile:


Viewing all articles
Browse latest Browse all 28182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>