Posted: Fri May 08, 2009 4:12 pm Post subject: need help making a GUI in turing to control a robotic arm i made
What is it you are trying to achieve?
<in my Computer engineering class my partner and i have designed and developed a compleatly functional robotic hand/forarm.
it works with about 4-5 stepper motors which are individually connected to 4-5 stepper motor driver circuits that i soldered up on pc board and connected to the parallel port of the computer.
through Turing, im able to control the direction, speed and on/off, of each of the individual motors with a basic code Turing code. i wish to have the ability to use keys on the keyboard that each control each motor according to what key you press and if possible, to press '1'(which represents stepper motor 1) and then use the arrow keys to turn the motor clockwise/counterclockwise.
the robotic arm that we created is out of Meccano and has a fingers that are opened and closed by activating a stepper motor which pushes a bike brake forward(pushing the finger closed) or backward(pulling the finger open). there are about 3 stepper motors for the fingers, 1 stepper motor that raises/lowers the forearm, and 1 stepper motor that rotates the base of the arm. >
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
<researching websites, used Google, asked my teachers, and tried using codes in the submissions section to do it. >
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing:
<Add your code here>
Please specify what version of Turing you are using
<its the Turing that my school has, i have to look. >
Sponsor Sponsor
DtY
Posted: Fri May 08, 2009 4:26 pm Post subject: RE:need help making a GUI in turing to control a robotic arm i made
Posted: Fri May 08, 2009 5:48 pm Post subject: 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
Posted: Fri May 08, 2009 7:50 pm Post subject: 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:
Turing:
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 endif %Et cetera.. endloop
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:
[syntax="turing"]var lastKey:string(1)
loop
getch(lastKey)
put ord(lastKey)
end loop
When you run that program, it will give you the value of whatever key you press, like if you press up it will give you 208 (**I think)
in the program you can test it like:
Turing:
getch(lastKey) iford(lastKey)=**keycode you got from other program**then %Do something endif
Hope that helps.
Homer_simpson
Posted: Fri May 08, 2009 9:18 pm Post subject: 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
Posted: Fri May 08, 2009 10:05 pm Post subject: Re: need help making a GUI in turing to control a robotic arm i made
Homer_simpson @ Fri May 08, 2009 9:18 pm wrote:
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
Posted: Sat May 09, 2009 12:22 am Post subject: 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
Posted: Sun May 10, 2009 8:30 am Post subject: Re: need help making a GUI in turing to control a robotic arm i made
You can get the materials needed for your project and you can work on it at home.
Sponsor Sponsor
jarredjoffe
Posted: Mon May 11, 2009 11:02 am Post subject: Re: need help making a GUI in turing to control a robotic arm i made
Homer_simpson @ Sat May 09, 2009 12:22 am wrote:
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
Posted: Mon May 11, 2009 1:14 pm Post subject: 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
untitled.bmp
Description:
here is the layout of the chip
Filesize:
960.05 KB
Viewed:
197 Time(s)
Homer_simpson
Posted: Tue May 12, 2009 12:11 am Post subject: 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
Posted: Tue May 12, 2009 5:15 pm Post subject: Re: need help making a GUI in turing to control a robotic arm i made
Homer_simpson @ Tue May 12, 2009 12:11 am wrote:
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
Posted: Tue May 12, 2009 5:29 pm Post subject: 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
Posted: Wed May 13, 2009 10:27 am Post subject: Re: need help making a GUI in turing to control a robotic arm i made
how bout this:
Quote:
%%%%%%%%%%%%%%%%%%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