
-----------------------------------
jarredjoffe
Fri May 08, 2009 4:12 pm

need help making a GUI in turing to control a robotic arm i made
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?
< i do not have enough experience with Turing to be able to script out a code that creates the GUI that i want. i am seeking help or guidance in creating a user friendly interface that tells the user what key operates what part of the arm. i also want the codes for each stepper motor not to allow the stepper motor to exceed a certain # of steps(so that the arm doesn't keep lifting and breaking/ bending the parts by accident) that's about it. >


Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using


-----------------------------------
DtY
Fri May 08, 2009 4:26 pm

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
http://compsci.ca/v3/viewtopic.php?t=8808

Look under graphics

-----------------------------------
jarredjoffe
Fri May 08, 2009 5:48 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
i had tried those things and had no luck, im still pretty new at this.

-----------------------------------
DtY
Fri May 08, 2009 7:50 pm

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
Since you're new at turing, maybe a gui isn't the best idea? You can do a menu pretty easily:

var lastKey:string(1) %String with a length of one
loop
cls %Clears screen
locate(1,1) %Moves cursor to top left for printing
put "1) an action"
put "2) another action" %Some menu items
getch(lastKey) %Read a key press, and store it in the variable lastKey
if lastKey = "1" then
%Do action for 1
elsif lastKey = "2" then
%Do action for 1
end if
%Et cetera..
end loop
If you want non-printable keys, you'll need to use the ord() function which gets the value of a character, you can use this quick program to do that:
getch(lastKey)
if ord(lastKey) = **keycode you got from other program** then
%Do something
end if

Hope that helps.

-----------------------------------
Homer_simpson
Fri May 08, 2009 9:18 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
YOU MUST POST PICTURES OF THIS! i'm really interested to know how that works out for u...!

-----------------------------------
jarredjoffe
Fri May 08, 2009 10:05 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
YOU MUST POST PICTURES OF THIS! i'm really interested to know how that works out for u...!

will do! hopefully that code works out, ill try it on monday since my materials are not around.

-----------------------------------
Homer_simpson
Sat May 09, 2009 12:22 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
actually if you'd share your circuit schematics with me i'll help you with your gui

-----------------------------------
tjmoore1993
Sun May 10, 2009 8:30 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
You know that Turing is available for download at the location below.
http://compsci.ca/holtsoft/

You can get the materials needed for your project and you can work on it at home. :)

-----------------------------------
jarredjoffe
Mon May 11, 2009 11:02 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
actually if you'd share your circuit schematics with me i'll help you with your gui

ill make the diagram today for sure.

-----------------------------------
jarredjoffe
Mon May 11, 2009 1:14 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
below i summarized what each pin goes to on the individual stepper motor circuits.

ps: the parallel ports are different for each stepper circuit (each circuit gets 2 ports from the computer)
-------
Chip: 3479p

L2,L1.L3.L4 ?all go to stepper motor

Pin 7(clock)- parallel port 3
Pin  10(clockwise/counter clockwise)- parallel port 2

Pin 1 doesn?t do anything


Pin 13,12,4,5,9,11,8, and 6(through 57k R) all go to ground

Pin 11 also goes through 4k to +12v
Pin 16 goes to +12v

-----------------------------------
Homer_simpson
Tue May 12, 2009 12:11 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
i was hoping to know how you made the connections with the parallel port. also let me see your code and tell me what it is you are trying to achieve with the gui so i can help you with it.

-----------------------------------
jarredjoffe
Tue May 12, 2009 5:15 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
i was hoping to know how you made the connections with the parallel port. also let me see your code and tell me what it is you are trying to achieve with the gui so i can help you with it.

the connection with the parallel port is made with a bunch of wires soldered onto each pin of a male connector which plugs into the parallel port at the back of the computer(if that's what you meant) then pins 2-9 are used for the stepper motor driver circuits (each driver circuit gets 2 inputs from the parallel port).

on Turing, the basic command that i have used to control one of the driver circuits is:

parallelput (2,3)% the '2' activates pin 2 which makes the stepper motor turn clockwise 
delay (100)     % if pin 2 is not activated, then the stepper motor turns counter clockwise
                % the '3' activates the clock which im pretty sure acts as a on/off as well as the speed of steps
                % the delay acts as a speed controller, counting the seconds between steps



since i don't have the actual code with me, that was more or less what it looks like. 
and as for the GUI, i don't have enough time rite now to restate what it is i want to achieve,  so ill edit my first post and highlight the part that tells you what it is i want to achieve with the GUI

thanks!
( o ya and pics are coming)

-----------------------------------
jarredjoffe
Tue May 12, 2009 5:29 pm

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
my bad, i forgot that i cant edit posts, so here:

i want the GUI to look like a basic menu that tells the user what key operates what part of the arm. the user must not have the ability to control the speed of the motor (clock) through the GUI.( so that parts don't fly off because the speed was set to fast)

and to have the ability to have a legend which tells users which number on the keyboard would control what part of the arm, then according to what number is pressed, a picture of the arm pops up and also shows what arrow keys on the keyboard must be pressed to move the arm in what direction. 
the user then has the option to use the arrow keys to press what arrow key he/she wants.

for ex:
if you press '1' on the key board (the '1'which represents stepper motor 1, will bring up a screen which shows the base of the arm and shows the left/right arrow keys with round arrows to represent what arrow key would turn the arm in the direction of left/or right) and then use the arrow keys to turn the motor clockwise/counterclockwise. 

 i also want the codes for each stepper motor not to allow the stepper motor to exceed a certain number of steps(so that the arm doesn't keep lifting and breaking/ bending the parts by accident).

-----------------------------------
Homer_simpson
Wed May 13, 2009 10:27 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
how bout this:
%%%%%%%%%%%%%%%%%%setup screen%%%%%%%%%%%%%
View.Set ("graphics:600;600;offscreenonly")
var mx, my, mb : int
var font1 := Font.New ("ariel:11")
colorback (darkgrey);
cls

%%%%%%%%%%%button procedure%%%%%%%%%%%%%%%%%%
procedure button (x1, y1, x2, y2 : int, text : string, proc aa)
    if (mx > x1 and mx < x2) and (my > y1 and my < y2) then
        drawfillbox (x1, y1, x2, y2, 66)

        if mb = 1 then
            aa
        end if
        Input.Flush
    else
        drawfillbox (x1, y1, x2, y2, 28)
    end if
    drawbox (x1, y1, x2, y2, black)
    Font.Draw (text, x1 + ((x2 - x1) div 2) - (Font.Width (text, font1)
        div 2), (y1 + y2) div 2 - 6, font1, black)

end button





%%%%%%%%%%%%move arm procedure%%%%%%%%%%%%%%%%%%%
procedure movearm1
    parallelput (2)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm1


procedure movearm2
    parallelput (3)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm2

procedure movearm3
    parallelput (5)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm3

procedure movearm4
    parallelput (5)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm4



%%%%%%%%%%%%main loop%%%%%%%%%%%%%%%
loop
    Mouse.Where (mx, my, mb)
    button (40, 400, 140, 500, "Move  up", movearm1)
    button (150, 400, 250, 500, "Move  down", movearm2)
    button (260, 400, 360, 500, "Move  left", movearm3)
    button (370, 400, 470, 500, "Move  right", movearm4)

    View.Update
    cls
end loop


-----------------------------------
jarredjoffe
Wed May 13, 2009 7:16 pm

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
thanks,
but im truing to make it so that the user uses the arrows on the keyboard to control what direction/how long to activate what stepper motor.

-----------------------------------
Homer_simpson
Thu May 14, 2009 2:34 am

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
you mean so the motor is turning for as long as you hold the arrow key?

-----------------------------------
jarredjoffe
Thu May 14, 2009 10:37 am

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
yes.

-----------------------------------
Homer_simpson
Thu May 14, 2009 8:06 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
%%%%%%%%%%%%%%%%%%setup screen%%%%%%%%%%%%%
View.Set ("graphics:600;600;offscreenonly")
var mx, my, mb : int
var font1 := Font.New ("ariel:11")
colorback (darkgrey);
cls

%%%%%%%%%%%button procedure%%%%%%%%%%%%%%%%%%
procedure button (x1, y1, x2, y2 : int, text : string, proc aa)
    if (mx > x1 and mx < x2) and (my > y1 and my < y2) then
        drawfillbox (x1, y1, x2, y2, 66)

        if mb = 1 then
            aa
        end if
        Input.Flush
    else
        drawfillbox (x1, y1, x2, y2, 28)
    end if
    drawbox (x1, y1, x2, y2, black)
    Font.Draw (text, x1 + ((x2 - x1) div 2) - (Font.Width (text, font1)
        div 2), (y1 + y2) div 2 - 6, font1, black)

end button





%%%%%%%%%%%%move arm procedure%%%%%%%%%%%%%%%%%%%
procedure movearm1
    parallelput (2)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm1


procedure movearm2
    parallelput (3)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm2

procedure movearm3
    parallelput (5)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm3

procedure movearm4
    parallelput (5)
    delay (100)
    locate (1, 1)
    put "moving arm"
end movearm4


var chars : array char of boolean

%%%%%%%%%%%%main loop%%%%%%%%%%%%%%%
loop
    Input.KeyDown (chars)
    Mouse.Where (mx, my, mb)
    if chars (KEY_UP_ARROW) then
        movearm1
    end if
    if chars (KEY_RIGHT_ARROW) then
        movearm2
    end if
    if chars (KEY_LEFT_ARROW) then
        movearm3
    end if
    if chars (KEY_DOWN_ARROW) then
        movearm4
    end if

    button (40, 400, 140, 500, "Move up", movearm1)
    button (150, 400, 250, 500, "Move down", movearm2)
    button (260, 400, 360, 500, "Move left", movearm3)
    button (370, 400, 470, 500, "Move right", movearm4)

    View.Update
    cls
end loop


-----------------------------------
DanTheMan
Fri May 15, 2009 8:29 am

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
Even though this post isn't overly helpful, I must wish you luck on creating a robot using turing. This seems very colo!

-----------------------------------
jarredjoffe
Fri Jun 12, 2009 3:12 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
here are the well awaited pics of the hand in its final stage of development.

i ran out of time with the cam, but ill take more pics on Monday of the circuit.

-----------------------------------
jarredjoffe
Fri Jun 12, 2009 3:16 pm

RE:need help making a GUI in turing to control a robotic arm i made
-----------------------------------
it feels like a million bucks finishing that hand, 
although the laptop that we programed it on was stolen today in another class! so my partner has to re-do the entire Turing programming since it was never saved on a flash key

-----------------------------------
jarredjoffe
Mon Jun 15, 2009 5:08 pm

Re: need help making a GUI in turing to control a robotic arm i made
-----------------------------------
more pics...
