Simple Basic Program

Hi

I want to make some sort of a program that just sends commands to my SSC-32 vie buttons in a window.

Eg. press a button and the program sends the following to the SSC-32

#0 p 750 s 1000

Press a different button (or release first button) and the program sends the following to the SSC-32

#0 p 1500 s 1000

I know nothing about C++ or any other programing languages. I am although willing to learn what is needed if someone can point me to a good application and tutorials or manuals.

I am hoping this isn’t to complex as all i wan the program to do is send a command to the serial port based on a click. I might be as bold as to make sliders for some motions , but lets not get ahead of ourselves here.

Thanks,

Here you go… It’s a free download and will do exactly what you want.
lynxmotion.com/Product.aspx? … egoryID=15

Ive got lynxterm. thats how i have been testing my system. I want to make a GUI for my model. that consists of clicks and releases. Very simple commands as the servos only operate switches and 2 position arms as well as a pan/tilt system.

Unless I am missing something and lynxterm meets my requirements

Thanks,

Oh! :blush: In case you didn’t know, there are 15 assignable buttons in Macros function. If so, sorry, I didn’t know you already had it.

Simple single click servo control GUI only using the Apache web server (free) and notepad.

geocities.com/zoomkat/ezservo1.htm

OK this program is fairly simple to learn for what I want. I have made a gui that sends commands to my SSC-32. I do want to make momentary push buttons though and cant figure that out. I want my continuous rotation servos(#16 + #17) to be momentarily on. I want to eliminate the STOP buttons and make the move buttons so that when I push down on it the move command is sent and then when I let go it sends the stop automatically.

Hopefully you can see how I am approaching this and advise me on a path to follow.

Here is my code:

[code]open “com1:115200,n,8,1,ds0,cs0,rs” for random as #comm

nomainwin

WindowWidth = 600
WindowHeight = 400

menu #main, "Tasks", "Nuetral Position", [NP]
button #main.button1, "CCW", [button1Click], UL, 235, 150, 40, 25
button #main.button2, "CW", [button2Click], UL, 325, 150, 40, 25
button #main.button3, "Center", [button3Click], UL, 275, 150, 50, 25
button #main.button4, "Stop", [button4Click], UL, 280, 175, 40, 25

button #main.button5, "CCW", [button5Click], UL, 235, 200, 40, 25
button #main.button6, "CW", [button6Click], UL, 325, 200, 40, 25
button #main.button7, "STOP", [button7Click], UL, 275, 200, 50, 25
button #main.button8, "CCWF", [button8Click], UL, 185, 200, 50, 25
button #main.button9, "CWF", [button9Click], UL, 365, 200, 50, 25

button #main.button10, "CCW", [button10Click], UL, 235, 225, 40, 25
button #main.button11, "CW", [button11Click], UL, 325, 225, 40, 25
button #main.button12, "STOP", [button12Click], UL, 275, 225, 50, 25
button #main.button13, "CCWF", [button13Click], UL, 185, 225, 50, 25
button #main.button14, "CWF", [button14Click], UL, 365, 225, 50, 25

open "Test" for window as #main
print #main, "font ms_sans_serif 0 16"
print #main, "trapclose [quit]"

[main.inputLoop] 'wait here for input event
wait

[button1Click]
print #comm, “#0p2250s300
wait

[button2Click]
print #comm, “#0p750s300
wait

[button3Click]
print #comm, “#0p1500s300
wait

[button4Click]
print #comm, “stop 0”
wait

[button5Click]
print #comm, “#16p1480
wait

[button6Click]
print #comm, “#16p1560
wait

[button7Click]
print #comm, “#16p1520
wait

[button8Click]
print #comm, “#16p1440
wait

[button9Click]
print #comm, “#16p1600
wait

[button10Click]
print #comm, “#17p1480
wait

[button11Click]
print #comm, “#17p1560
wait

[button12Click]
print #comm, “#17p1520
wait

[button13Click]
print #comm, “#17p1440
wait

[button14Click]
print #comm, “#17p1600
wait

[NP]
print #comm, “#0p1500 #1p1500 #2p1500 #3p1500 #16p1520 #17p1520
wait

[quit]
confirm “Do you want to quit Test?”; quit$

if quit$ = "no" then wait
close #main
close #comm

End[/code]

Looks like just basic type of code. If so, the below code bits have on/off type controls associated with the left mouse button. You probably would need to fabricate your own buttons since this action may not be supported by normal button actions.

nomainwin
 open "Move something!" for graphics as #w
  print #w, "when leftButtonDown [Move]"

  wait
[Move]
  print #w, "\Moving Left"
  print #w, "when leftButtonUp [Stop]"
  wait
[Stop]
  print #w, "\Now Stopped"
  wait
 'Stylebits #demo.btn1, 0, _WS_BORDER, 0, 0
    Graphicbox #demo.btn1, 100, 100, 80, 80
    Open "Pseudo Buttons" for Window as #demo
    #demo, "Trapclose XbyTrap"
    #demo.btn1, "Down; Fill Buttonface"
    #demo.btn1, "Color Black; Backcolor 0 255 0"
    #demo.btn1, "Place 0 0; Boxfilled 80 80; Flush"
    #demo.btn1, "When leftButtonDown MotorOn"
    #demo.btn1, "When leftButtonUp MotorOff"

Wait

Sub XbyTrap handle$
    Close #demo
    End
End Sub

Sub MotorOn handle$, xVar, yVar
    #demo.btn1, "Backcolor 255 0 0"
    #demo.btn1, "Place 0 0; Boxfilled 80 80; Discard"
    'Playwave "annoyingsound.wav", Loop
    print "MotorOn"
End Sub

Sub MotorOff handle$, xVar, yVar
    #demo.btn1, "Backcolor 0 255 0"
    #demo.btn1, "Place 0 0; Boxfilled 80 80; Discard"
    'Playwave ""
    print "MotorOff"
End Sub

Thanks Zoomcat I will give those a try.

Now I have another question. When I send a VA command to my SSC-32 I get funny foreign characters in response and not the voltage. This is confusing even when I use lynx term and type VA I get different Foreign looking Characters In Response.

Any Ideas, This doesn’t seem to be right or am i doing something wrong.

Cheers,

It returns a binary value, not a character. If the binary value happened to be within the ASCII subset that represents common alphabetic characters you would see a character you recognize. Instead you are getting an extended character and what it looks like will be based upon the font used by the application. :wink:

Below is some code I’ve used for reading the voltage from the servo pot as the servo is moving, and to check if a simple limit switch on the servo arm has been closed.

open "Com5:9600,n,8,1,ds0,cs0,rs" for random as #comm

Print #comm, "#0P2200" 'initial servo position

y=0 'outside loop counter

[loop]

timer 2000, [delay2] 'iniial delay before timed move
wait
[delay2]
timer 0

x=0   'inside loop counter

'start 3 second move
Print #comm, "#0P1100T3000"

[loop1] 'inside loop

x=x+1

y$ = "VC"

Print #comm, y$ 

timer 20, [delay] 'read return delay
wait
[delay]
timer 0

dataRead$ = input$(#comm, lof(#comm))

num = ASC(dataRead$)
print num

if num > 100 then Print #comm, "STOP 0"

if x < 100 then [loop1] 'test for switch closure


Print #comm, "QP0"

timer 50, [delay3]
wait
[delay3]
timer 0

dataRead$ = input$(#comm, lof(#comm))

print dataRead$ 'print out servo position
print ASC(dataRead$)

Print #comm, "#0 P2200"

print ""

y=y+1

if y < 10 then [loop] 'set for 3 loops

print "done"

Close #comm

Hi

My project is moving along better than expected and I am actually starting to get kind of cocky I guess. I’ve been playing with sprites a little and am trying to get a sprite to rotate as the voltage from the VA return changes.

This is the section of code that I am playing with for this tool. Obviously I cant get it to work the way I want. I can rotate sprites using the “spriteorient” statement , but I think it is my “if” statements that are the problem.

Print #comm, "VA" timer 10, [VAdelay] 'read return delay wait [VAdelay] timer 0 dataRead$ = input$(#comm, lof(#comm)) VA = ASC(dataRead$) print #main.VA, using("#.##", VA * 5 / 256) + " v"; print #main.box, "addsprite Arm Indicator"; print #main.box, "spritexy Arm 700 50"; if VA < 45 then print #main.box, "spriteorient Arm rotate 0"; print #main.box, "drawsprites"; if 26< VA <75 then print #main.box, "spriteorient Arm rotate 20"; print #main.box, "drawsprites"; if 76< VA <125 then print #main.box, "spriteorient Arm rotate 40"; print #main.box, "drawsprites"; if 126< VA <175 then print #main.box, "spriteorient Arm rotate 60"; print #main.box, "drawsprites";