Holy smokes a crap ton of replies.
So let me try and re-explain what I would like to do.
This is phoenix code FYI so I’ll use things you can understand if anyone has the Pheonix.
I want to get a number more twords 0 as the stick moves more forward, or more left or more right or more down… but for the sake of this example I’m just looking for code for 1 channel “Left and Right”
So currently as it stands the values I get out of debug are so not even right, I’m guessing some other bug is taking over because When I plop the values in my TI-89 calc they all come out how I want them to come out.
My range on the remote doing a Pulsin read of channel 1 I get
1088 Left
1912 Right
1500 Centered.
the values that are easy to get are subtract 1500 from that pulsin read so you now get
- 412 Left
0 Centered
412 Right
we are getting closer.
What I then do is Add +412 to the Left and find the absolute value of it thus giving me zero and only positive numbers up to 412.
Then I subtract 412 from the right and find the absolute value of it thus giving me zero and the only time I have a 412 number is in the smack dab center position.
What I am trying to do honestly is in this pheonix code set SSCTime delay based on the location of your stick "I understand 412 might be a high ssctime value although I can simply divide this to find what works and what doesn’t IE by 2 which takes my range from 0-206 as an example.
In the pheonix code Zenta had shared with me on the t7C transmitter there is a channel 6 pot which is simply a knob that turns up or down SSCTime… Well… I want to eliminate that and get ssctime value “which i’m guessing is some sorta of ms delay for servo updates” … I want to get ssctime value based on the inverse of the stick positions the stick a little forward the robot moves slow with a slow walk then push the stick forward all the way and its walking faster…
Hope this explains what kinda values I’m getting, the code above I posted works 100% in my calculator but when tossed onto an atom pro it’s like there is other things trying to modify the variable and I’m really not sure why its doing this , it works fine on paper???
that is unless there is a alternative way of doing this?
Do I need to have a line that copies the contents of RCInput(0) and puts it into a variable right after the read input?
Somevariable = RcInput(0)
If RcInput(0) > 1500 then
InputTimeDelay = (Abs(SomeVariable) - 1500 ) + 412)
Else
InputTimeDelay = (Abs(Abs(SomeVariable) - 1500 ) - 412))
Endif
when I run the code from my top post I move the sticks left and right and I see 1 instance where inputTimeDelay = 0 and the stick isn’t centered or all the way to the left or right…