go away spammer

Author Topic: roborealm syntax  (Read 1688 times)

0 Members and 1 Guest are viewing this topic.

Offline sloTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
roborealm syntax
« on: March 21, 2009, 12:19:11 PM »
Beginner here. Have PC mounted on and controlling differential drive platform w/DE sabertooth 2x25 speed controller in packet serial mode.  For starters want to use onboard joystick to move the thing around the room to get it out of my way.  Using roborealm I've dragged over the Joystick, VBScript Program, and DE_sabertooth modules.
I've written this to hopefully scale the variables properly but I cant get it to do anything at all.  It says error (8) expected ")" but as far as I can see the parens are all matched up.  Please correct any errors you notice.  Thank you.
Code: [Select]
dead_x = 4
dead_y = 10
scale_y = 0
scale_x = 0
motA = 0
motB = 0
while(1)
scale_y = ((-1)y_joy)(128/1000)+128 ;make joystick y an unsigned 8bit integer center at 128
if scale_y <= dead_y
 scale_y = 0
scale_x = (x_joy)(128/1000) ;make joystick a signed 8bit integer center at 0
if scale_x <= dead_x
 scale_x = 0
motA = scale_y+scale_x+128
motB = scale_y-scale_x+128
I've never programmed anything before and all the VBscript tutorials I've found are on HTML stuff.  I'd like to use C but figure if I cant get this to work I'd have an even harder time with a compiler.  Also, I would like the speed to start at 1 and move progressively once out of the deadband instead of suddenly jumping to 4 or 10.  How would I do that?

Offline sloTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: roborealm syntax
« Reply #1 on: March 22, 2009, 09:17:13 AM »
Still dont know why the error I got was expected ")" but I did notice that I neglected to use the * operator. It didn't like my comment lines so I removed them. Then it says expected Wend. Apparently the while loop needs to be closed. If I type wend at the end, reload and run, it locks up roborealm. This is what I have now. It also locks up roborealm but at least it doesn't say expected ")".  Anyone have an idea to get this working?
Code: [Select]
dead_x = 4
dead_y = 10
scale_y = 0
scale_x = 0
motA = 0
motB = 0
do
scale_y = (-1*y_joy)*(128/1000)+128
if scale_y <= dead_y then scale_y = 0
scale_x = (x_joy)*(128/1000)
if scale_x <= dead_x then scale_x = 0
motA = scale_y+scale_x+128
motB = scale_y-scale_x+128
loop
slo
« Last Edit: March 22, 2009, 09:18:42 AM by slo »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: roborealm syntax
« Reply #2 on: April 08, 2009, 01:33:55 AM »
did you try posting on the roborealm forum?

(don't forget to link that post to here)

 


Get Your Ad Here

data_list