I am going to preface this with two statements:
1- I am VERY new to Arduino programming and even newer to using the XOD ide.
2- I did attempt searches for this topic. both within the XOD forum and through Google.
it seems all results are showing the use of a potentiometer to adjust servo position.
I am trying to make a servo swing to a given PWM (2000uS) at a specific time component (0.85sec) at the press of a momentary button and stay there until the button is pressed again. When this momentary button is pressed again, the servo will return to it’s original starting location (1000uS) as fast as possible depending on voltage applied to the given servo. this return speed is not critical, but it but be as quick as the servo can travel.
I have found some information on https://xod.io/docs/guide/servo/ and with https://xod.io/docs/tutorial/107-manipulator/
I have tried and failed to get the following Project to function in the simulation or on my Arduino board, even though it compiles properly.
however, I have only been able to make the servo move slowly bidirectionally with the following project.
any help to get a servo running from 1000uS to 2000uS over the course of 0.85sec upon the push/pulse of a momentary button and hold that 2000uS until the button is pressed again at which time the servo returns from 2000uS to 1000uS as fast as possible would be greatly appreciated.
I would make it like this.
That definitely gets the result while the system is powered on. Thank you. Like I said, I’m still wrapping my head around all of these nodes and the Arduino environment as a whole. I had no idea a ‘branch’ node existed nor how it is used, that helps a lot.
I rebuilt your example and it works well while everything is running, but now cannot get the program to start in a default 1000uS PWM from my D10 pin. The board doesn’t seem to output any PWM from my digital pin until the button is pressed once. only then, does the code start it’s loop and continuous update. I’ve even tried to set the RST on the flip-flop node to boot, that didnt work. I also tried inserting a boot node and running it to the RST input on the flip-flop, to no avail…
Can you offer insight on getting this to function at system boot-up?
We just had a discussion about this topic: SERVO AND FADE . fast start . slow return
Thank you. I hadn’t seen this as I haven’t been searching for the past couple of weeks. I’ve reading and practicing other projects to try and be less inept regarding programming for physical responses over from https://dronebotworkshop.com/getting-started-with-xod/
I’ll read through those posts and see where I end up.
thank you again,
Sure, placing the
RST you change only the
MEM value to
false on boot. Add the boot pulse to rotate too.
Keep in mind that there are very old XOD tutorials, and there are things that have changed.
If not use the version of the turorial in that case 0.19.2 some things may not work.
This may not be the case, it is only a suggestion.
Thank you again. That solves the state selection upon boot! This works perfectly every time now. I understand that like with most things there are multiple ways to solve the problem or write many different forms of code to get the same result. This really helps get my result… now it’s up to me to further educate myself on the ‘how’ this is done so I can become somewhat competent.
So this is searchable in the future, here is an image of the full Xod Project;
Thank you again,
flip-flop will start with MEM=0, so RST=Boot is redundant. The issue is that you need to pulse rotate-DO as others have mentioned to start control of the servo.
As pointed out in the other thread I linked to above, combining rotate-slow & rotate in the same patch like this can result in problems. If the button is pushed while rotate-slow is still active, both rotate-slow & rotate will be trying to control the servo at the same time. As the other thread states, you can use multiple rotate-slow nodes sharing the same MUX, but that will probably force the servo to finish its travel before allowing it to switch directions. Whenever possible, it is better to use a single node to control a single device and change the inputs to the node rather than using multiple nodes with different fixed inputs. The other thread demonstrates using if-else to change RATE, the same thing can be done to change VAL.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.