I'm trying to prepare a layout for my project using fritzing. The device will send midi messages when you press a footswitch and an LED will light up. The code is more or less working but I know from experience what a jungle of wires you can end up with - I want it to be as tidy as possible, so intend to use some veroboard to mount the resistors.
I'd appreciate any comments about this layout, is there a better/neater approach?
Your switch wiring seems wrong, Looks like all 4 will short out Vcc.
I'm guessing the black wires from the switches to ground are not supposed to be there.
For better comments on your implementation it would be better to group devices in the enclosures they will inhabit and make the interconnect cables more obvious. i.e. could draw a dotted eclipse around the groups to wire that will make up a cable.
I would solder header pins onto the Arduino, then put 2 rows of female header-pins on a exp-printplate, mount the DIN-plug (s) on that and if the resistors don't fit in the foot switches, mount them on there also, add midi-in/thru and the other DIN plug already. Are those other button supposed to be for use by your hands ?
Oh those things at the bottom are the LED's so i would mount all components on a piece of prototyping board which include some female header pins to stick the male header pins of the Arduino in and put 1 enclosure around it, which can have the DIN plugs coming out the side and a have a powersupply input on it as well, the LED's sticcking out the top, the foot switches i don't know how they look..
It is better to let the buttons be 'active-Low' so they get grounded-out when pressed using either the internal pullup or putting your own pull-up resistors.
That teaches you that you need a pull up or pull down resistor with a switch,
to give the pin a wel defined logic level when the switch is not pushed (not part of the circuit).
Once you know that, you never use external pull up/down again.
Well, maybe only some (additional) stronger pull up in very noisy environments and/or with long wiring.
Most processors used here have buildin pull up, that can be enabled with code.
pinMode(switchPin, INPUT_PULLUP);
Pull up, and the switch wired between pin and ground could also be safer.
No 5volt running to the switch, that can shortcircuit to ground.
With pull up, logic is reversed. The pin is now normally HIGH, and goes LOW when the switch is pushed.
if (switchPin == LOW) { // do something
Leo..
Wawa:
Most processors used here have buildin pull up, that can be enabled with code.
pinMode(switchPin, INPUT_PULLUP);
Pull up, and the switch wired between pin and ground could also be safer.
That's wonderful - thanks for letting me know. Less parts, simpler wiring, it's all good
That is (just one of the instances) why we find the Arduino "tutorials" which have proven unable to be corrected, to be less than useful and in fact, counter-productive.
The (hyperbole) "100s of Arduino images" turn out to be many copies of a very few.