I’m new to the XOD community, and quite honestly, pretty new to Arduinos in general; up until now I’ve only used them from the standpoint of uploading pre-written code and/or making minor adjustments to pre-existing code, such as for my 3D printer or this-or-that Instructables project. However, I’m now trying a from-scratch project of my own, and after having run through the entire XOD tutorials (yes; I ordered light sensors and anything else I didn’t already own in order to complete them all. ) I find myself stuck on two related-yet-different issues:
- I need a servo to activate on a temporary-button press, running all the way from “0” to “1” then back again; in theory the button can only be hit once per full-“cycle” of the servo, but that is not a given - and if it is hit while the servo is not at a 0/1 position, it needs to go right back to trying to fulfill a “0 to 1” movement - so a strict on/off button doesn’t seem like a possibility.
- The servo is listed as having a speed of “0.10 sec/60*” but there’s absolutely no way it is moving anywhere near 180* in a third of a sec (not to mention that it doesn’t even seem to move a full 180*).
What sort of nodes should I use to set this up? I’ve tried to work out some logic for this but as of now none of it is saved as it all failed. I feel like this should be fairly simple, but I can’t seem to come up with the logic to do so (and don’t know if it’s just because I don’t understand the full extent of XOD node functionality beyond the tutorial; like, maybe there’s a node or two that are designed to do exactly this sort of operation, but I just don’t know where/what they are).
Thanks in advance for any help!
Probably not exactly what you want, but it is something to get you started. On boot, the servo should move to position 0. If you press the button, servo will start moving to position 1 (speed determined by fade-RATE. When button is pressed again, servo will start moving back to 0 (even if it has not finished moving to position 1 yet). Too lazy to setup hardware, so this hasn’t actually been tested…
If you want a full 0-1-0 cycle, you can add a feedback from the fade output that pulses toggle-SET when fade output equals 1. Getting servo back to 0 & starting a full cycle if button is pressed in the middle of a cycle might be tricky. You might want to feed fade-RATE from a select so you can use 1 to quickly return to position 0, then switch back to a slower rate to run your cycle. You will need to add a delay to make sure servo has time to return to position 0, then done pulse can be fed to flip-flop-TGL to start cycle.
Awesome, thanks so much!
Your code actually seems to result in the button push sending the servo to 1 when it is pushed, but if it is pushed again before it reaches there it actually just stops its movement until a third push, which goes back to 0. But that’s more than enough to get me started, and it’s a lot of info to unpack - I don’t know how long it would have taken me to get this far on my own, lolsigh. So again, thanks for the help!
When you say
If you want a full 0-1-0 cycle, you can add a feedback from the fade output that pulses toggle-SET when fade output equals 1.
What are you referring to by “toggle-SET”? I’m looking all over for a toggle node and I can’t find it anywhere, so I’m guessing I am just misinterpreting what you said…or I am not actually finding that node, which - since I can’t seem to figure out a way to actually search for nodes in the IDE is totally possible.
Sorry. It is flip flop, not toggle.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.