Shop OBEX P1 Docs P2 Docs Learn Events
PSC tutorial — Parallax Forums

PSC tutorial

exskoolexskool Posts: 24
edited 2006-01-20 18:11 in Robotics
Hi again...

Regarding the position reporting provides by PSC, can anyone helps me to make a code so that i can increase the servo position by step of 20 (just an example) from its current position, whenever it is at that time...

I tried to use the command report position, '!SCRSP', and the input receive are
x y z(where x is the channel number, and z:y is the value reported)...
so if i interested to increase the current position to 20, should i make the code like
position = buff(1) + buff(2) + 20
·(by using·the same variables use in the PSC documentation)

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-20 18:11
    Adding the bytes won't increase the position by 20.· One is the lowbyte and the other is the highbyte.· The highbyte value should be multiplied * 256 before being added to the lowbyte and then to the offset to get the correct value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.