Notifications
Clear all

Two macros per input?  

  RSS
MStefan99
(@mstefan99)
Membre
Two macros per input?

Is it possible to run different gcode on rising and falling edges of an input signal? I want to enable stealth mode at night (in the dark) by using a photoresistor with a Schmitt trigger and disable it during the day.

Also, is there power available on the GPIO board so that I could avoid an external power supply?

Thank you

Publié : 20/10/2024 10:28 am
Sembazuru
(@sembazuru)
Prominent Member
RE: Two macros per input?

Reading the GPIO page, I see this text:

When an input pin is configured using M262 and set to 1 (input mode), the state of the pin is periodically checked every 0.5 seconds.

If a button connected to the pin is pressed (pin state goes LOW), it triggers a macro button. For example, a button on pin 7 can automatically execute a macro stored in the file macros/btn_7.gcode on a USB drive. The macro is injected into the print sequence, with a size limit of 1024 bytes.

I don't think you can get it to edge detect. No interrupt support, only polls twice a second, only triggers a macro on LOW. The way this is worded, I doubt it would continuously fire the macro with an input held low, but would want to verify empirically.

For your application with the implementation provided to us, you would probably have to burn two input pins, and put a not gate between your photo signal and the second input. Make sure that the output of your Schmitt trigger (and inverted Schmitt trigger) is 3.3V. I don't see anywhere in the documentation that the GPIO board is 5V compatible, so I wouldn't make the assumption that it is.

Looking at the board, I don't see any places to tie into 3.3V unless you find a power pad and tack a wire to that. I wouldn't expect to pull much current though. I also haven't (yet) found a spec to know how much current the open-drain outputs can sink.

See my (limited) designs on:
Printables - https://www.printables.com/@Sembazuru
Thingiverse - https://www.thingiverse.com/Sembazuru/designs

Publié : 21/10/2024 11:27 pm
Partager :