-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ConfigurableFirmata.ino #163
Conversation
Adding option to: - Start all output pins at "HIGH state" to the example file.
Thanks for this addition |
I need more help on this, can not solve it alone. 🥺 I've just tried this code I've commited in real life, and
I do not really understand why, and no matter what I try it makes things just worse. That means, if I apply this patch with ConfigurableFirmata + Raspberry Pi PICO board,
So there are 2 problems:
I've tried to copy the set-high code to the setup part too, but than the board goes into an infinite boot loop. void setAllHIGH() {
PinStatus p = HIGH;
for (byte i = 0; i < TOTAL_PINS; i++) {
if (IS_PIN_DIGITAL(i)) {
//if (i > 2) {p = LOW;} else {p = HIGH;} ; // uncomment this for testing (distunguish 1+2. pin and all the others)
digitalWrite (i, p);
Firmata.setPinMode (i, PIN_MODE_OUTPUT);
digitalWrite (i, p);
Firmata.setPinState(i, p);
digitalWrite (i, p);
}
}
} |
First question: What board are you using? The Arduino AVR-based boards boot with all pins in INPUT mode, so yes, they're floating. You should be able to add external pull-up resistors to make the input high at startup (and thus turn off the relays). I can't say why it would then switch to low when the Startup code runs, I'll need to try. |
RPi Pico (see my prev. msg)
Yes, I know. It seems also this board does.
Thank You! 😄 |
I just tried with an Arduino Nano, and this code works for me (all outputs high after boot phase):
|
So basically you just uncommented the 2 lines at my original Commit, and it works "out of the box" ?
|
No, I just uncommented your lines (except that the first line should not have the |
After investigating the problem from all sides, I've realized:
to prevent any accidents. There are 2 possibilities: 1. Use PNP / NPN inverter boards:https://duckduckgo.com/?t=ftsa&q=PNP+NPN+opto+board&iax=images&ia=images 2. Use "High-triggered" Relay boards.https://duckduckgo.com/?q=high+trigger+relay+board&t=ftsa&iar=images&iax=images&ia=images ... or those kind, which have jumpers to where someone can choose between Low trigger / High trigger See those yellow jumpers on the picture. So this commit should be reverted fully. |
Now I'm curious: Why is it not safe? Can you explain that? |
< OFF >
Connecting heavy metal roller-shutters on those relays which can basically cut a head off, or "over-driving a heater" because it did not turn off... |
Yikes... I do prefer if my head stays exactly where it is... |
Adding option to:
to the example file.