Skip to content
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

Default Low/High on startup #100

Closed
PizzaProgram opened this issue Nov 21, 2020 · 6 comments
Closed

Default Low/High on startup #100

PizzaProgram opened this issue Nov 21, 2020 · 6 comments

Comments

@PizzaProgram
Copy link
Contributor

PizzaProgram commented Nov 21, 2020

I think it would make life easier for beginner {like me ;-) } if the firmatabuilder would "ask about" the default settings of output pins.

Temporary I'll try to use the method mentioned here: #firmata/arduino#166 (comment)
but it can have serious consequences if predefined to a different state as it should be when the board starts.

< OFF >
For example:
I'm building currently a 8+8 relay-board roller-shutter system.
Those 230V tube-motors are very strong and those heavy metallic things can basically cut off a child's head...

< /OFF >

@soundanalogous
Copy link
Member

It's more complicated that that. The ability to enable reporting of individual digital pins needs to be added first, which is a big change from how Firmata has historically worked so it will not land until Firmata 3.0, which has no definite schedule.

@soundanalogous
Copy link
Member

My advice is if you are controlling potentially dangerous equipment, is not to use Firmata, but to design a simple protocol that will meet your needs while giving you full control over the code running on your Arduino.

@PizzaProgram
Copy link
Contributor Author

PizzaProgram commented Dec 1, 2020

I understand.
The good news is: it seems the code works.

void setup()
{
# Uncomment following 2 lines, if you want to start the board at power-up on LOW or HIGH state
#  byte pin;
#  for (pin = 0; pin < TOTAL_PINS; pin++) {     digitalWrite(pin, HIGH);     }
...

I recommend to copy this few lines to :
StandardFirmata.ino (ca. at line 700+)

And firmatabuilder should have an extra checkbox to enable it too.

That would be already a HUGE help to us, beginners.

< OFF >
IMHO You can not prohibit people to use your code at automatisation systems.
Especially because Node-Red even recommends to use it, and there are some industrial systems done with it already.

My personal opinion is, that currently Firmata is more stable than any other "ad-hock" created serial service.
(Maybe Ardulink has still some chance to grow to IoT standard, but Firmata already IS one.)
< /OFF >

@PizzaProgram
Copy link
Contributor Author

Is it possible to define a global variable (or activate any hidden feature) to:

force all pins to work in INVERTED mode?

Where LOW becomes HIGH in all cases, and the other way around. Also all output pins are initialized HIGH at the beginning instead of LOW.

Something like:

#define ENABLE_INVERT_MODE 

@pgrawehr
Copy link
Contributor

No, there's currently no such option. However, the startup values are directly in the ino file and can easily be changed there.

@PizzaProgram PizzaProgram closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2024
@PizzaProgram
Copy link
Contributor Author

Rather than waiting,
created a pull req. myself.
#162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants