
I'm having a problem getting the Set(digital port,on/off) to work.
If I run this code, it works....once. Code:
Set(1.D22,on)
Sleep(300)
servo(1.D22,90)
sleep(5000)
servo(1.D22,40)
sleep(5000)
servo(1.D22,90)
sleep(5000)
servo(1.D22,130)
sleep(5000)
servo(1.D22,90)
sleep(2500)
Set(1.D22,off)
When I run it again, the servo does not move. The code runs without any errors.
The only way I can get it to work again is by shutting down the program and the EZB's and restarting. I must not be doing something right, the port is turned off by the command (i can hear that in the servo) but the Set On command doesn't turn it back on.
Upgrade to ARC Pro
Get access to the latest features and updates with ARC Early Access edition. You'll have everything that's needed to unleash your robot's potential!
you may try this
Code:
That should pause until the 1.D22 port is on before continuing.
Code:
to make sure the port is off and recognized as off prior to continuing but, this would just be something good to have, and probably not the cause of the issue.
Code:
and the code doesn't run after those 2 line, just sits there. So that tells me that the port is not turning on. I also tried it with a longer sleep time - that doesn't work either.
The Set(1.D22,on) will send a high signal down the signal wire (3.3 v to 5 v probably). This isn't really turning on or off the port, but is more setting the digital port to high or low.
The servo on the other end would get up to 5 volts on the signal wire with what you are doing. Set(1.D22,off) sets the signal cable to 0 volts. I think what is happening is when it goes to 0 volts, the servo stops responding.
I dont know your setup, so maybe this is what you want. Please verify.
Release (1.D22)
Code:
Alan