Proffieboard V3.9 powering extendable/retractable blade design?

99 times out of a 100, when you want to control something in ProffieOS, you want to use a “blade” to do it. It doesn’t matter if it’s a LED, a rumble motor or whatever, usually having the full expressive power of the styles system is what you want to control it.

If all we want is to run the motor for a set amount of time on extension and retraction, we could do that by hooking up the driver board to Free1 and Free2. Then we can set up a SimpleBlade to control Free1 and Free2 such that “Blue” means “OUT” and “Red” means “IN”. Then all we would need is a style that lights up blue for a few seconds on extension and red for a few seconds on retraction.

If there are endstops and stuff to take into account, that can probably be arranged as well by using ReadPin<> in the style.

However, extension/retraction on every activation might not be what you actually want. Having a separate button for it wouldn’t be particularly difficult, but will require some custom coding in the prop. Basically you would add a button to the code, but make it an unusual button, like “UP”. Then you create a new prop, which inherits from whatever prop you like, then override Event2() to catch the events related to your new button and do whatever digitailWrite() stuff you need. (But make sure to call the inherited Event2 so that it can handle all the other buttons.)

The only tricky part about writing code for ProffieOS compared to regular arduino code is that you can’t wait for anything to finish. ProffieOS has things to do, so everything you do has to be be done in small, quick increments. If you need any help with that, please let me know.

1 Like