LOGO-L> MSWLogo 6.4 and the JoyStick examples 
Author Message
 LOGO-L> MSWLogo 6.4 and the JoyStick examples

Someone mentioned they had problems with the JoyStick examples drawing
dashed Lines. This may be due to "optional" features on your JoyStick.
Some JoySticks have switches to repeatedly "Fire" the buttons. The
JoySticks I have seen you can shut this on or off. By the way games
pads also worked but not as much fun as a joystick.

Second I noticed that some machines did not like the use of address
512 (200 hex) for reading the buttons. But all machines seem happy
with 513 (201 hex). The JoyStick examples use 512 (you might want to
change them to 513). I have fixed this for the next release.

I have tested a Non MMX Pentium I 133 and it ran fine.
I have tested a Pentium II 300 and it ran fine.
I have tested a Pentium II 450 and it ran fine (but needed the 512 -> 513)
to get the buttons to work.

So I think my "Scaling" to the performance of a machine is working
pretty good.

One machine did weird stuff, like it would start moving forward
when I held the stick full left. This problem went away after adjusting
the center "trim pots".

Note also the lines it draws may have little bumps (pixel warts) on them.
This is due to how the rasterizer draws small line segments along a
line at odd angles. This is normal. Thicker lines look better.

If anyone has seen problems other than described here I'd like to know
about them and will do my best to sort out what is going on.

to aaa
;
; This example uses the joystick to move the turtle around the screen
;
drive
end

to drive
cs
; This sets how much range of the stick is dead
localmake "DeadRange 0.07
; Time the speed of the computer to adjust the sensitivity
localmake "start timemilli
repeat 360 [rt 1]
localmake "elapse timemilli - :start
localmake "TurnSensitivity  :elapse/150
localmake "SpeedSensitivity :elapse/75
localmake "ShouldWe "False
if not namep "ZeroLeftHeading [localmake "ShouldWe "True]
if not :ShouldWe [localmake "ShouldWe YesNoBox [Calibrate] [Do you wish to Calibrate?]]
if :ShouldWe~
  [
  MessageBox [Calibrate] [We are now calibrating the Joy Stick, Hands Free]
  localmake "ZeroHeading ingameport 1
  localmake "ZeroSpeed   ingameport 2
  MessageBox [Calibrate] [Hold Full Right]
  make "FullRightHeading  ingameport 1
  MessageBox [Calibrate] [Hold Full Left]
  make "FullLeftHeading   ingameport 1
  MessageBox [Calibrate] [Hold Full Forward]
  make "FullForwardSpeed  ingameport 2
  MessageBox [Calibrate] [Hold Full Back]
  make "FullBackwardSpeed ingameport 2
  make "ZeroLeftHeading   int (:ZeroHeading  - (:ZeroHeading  - :FullLeftHeading) * :DeadRange)
  make "ZeroRightHeading  int (:ZeroHeading  + (:FullRightHeading - :ZeroHeading) * :DeadRange)
  make "ZeroForwardSpeed  int (:ZeroSpeed    - (:ZeroSpeed   - :FullForwardSpeed) * :DeadRange)
  make "ZeroBackwardSpeed int (:ZeroSpeed    + (:FullBackwardSpeed  - :ZeroSpeed) * :DeadRange)
  ]
MessageBox [Joy Stick 2D] [Y Axis is Speed, X Axis is Turning, Button 1 is PenDown, Button 2 is CS]

do.while ~
  [ ~
  localmake "CurrentHeading ingameport 1
  localmake "CurrentSpeed   ingameport 2
  localmake "CurrentSwitch  inportb 513
  ifelse not ((BitAND :CurrentSwitch 16) = 0) [pu] [pd]
  if         ((BitAND :CurrentSwitch 32) = 0) [cs]
  if :CurrentHeading < :ZeroLeftHeading ~
  [lt :TurnSensitivity  * (:ZeroLeftHeading-:CurrentHeading)  / (:ZeroLeftheading-:FullLeftHeading)]
  if :CurrentHeading > :ZeroRightHeading ~
  [rt :TurnSensitivity  * (:CurrentHeading-:ZeroRightHeading) / (:FullRightHeading-:ZeroRightheading)]
  if :CurrentSpeed   < :ZeroForwardSpeed ~
  [fd :SpeedSensitivity * (:ZeroForwardSpeed-:Currentspeed)   / (:ZeroForwardSpeed-:FullForwardSpeed)]

  if :CurrentSpeed   > :ZeroBackwardSpeed ~
  [bk :SpeedSensitivity * (:CurrentSpeed-:ZeroBackwardSpeed)  / (:FullBackwardSpeed-:ZeroBackwardSpeed)]
  ] ~
["true]
end

to zzz
ifelse YesNoBox [Welcome] [Choose YES to run example now, Choose NO Study it now.] [aaa] [edall]
end

Make "startup [zzz]
--
===============================================================
George Mills

http://www.*-*-*.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------





Tue, 03 Jul 2001 03:00:00 GMT  
 LOGO-L> MSWLogo 6.4 and the JoyStick examples
Hope you don't mind my posting this reply.

I appreciate your taking the time to get back to me.

I've only tried one GamePad so far and it ran "Full Throttle" as soon as you
touched the pad in any direction. I think that's basically how TouchPads
work. The JoyStick.LGO example had a JoyStick in mind which allows you a wide range
of control over speed and a wide range of control over the heading as well. But the example
is usable with a GamePad but it is not as nearly fun as with a JoyStick. The
fun part comes in when mixing different ratios of how fast your turning and how
fast you moving forward which you can't do very well with a gamepad (i.e.
small circles, big circles, spirals etc.).

A more appropriate example could be written for a gamepad.

You can slow it down by changing from

localmake "TurnSensitivity  :elapse/150
localmake "SpeedSensitivity :elapse/75

to something like

localmake "TurnSensitivity  :elapse/300
localmake "SpeedSensitivity :elapse/150

Remember this is just an example of how to use the gameport, there are an infinite number
of possibilities of applying the GamePort to a Logo Application whether it be a GamePad,
JoyStick, Thermo Couple device or what ever. Use your imagination of how you can map the
GamePad controls to the functions you want to perform. The controls could be mapped to
the parameters of any function.

Quote:

> >Someone mentioned they had problems with the JoyStick examples drawing
> >dashed Lines.
> (-:

> I tried the new example and no dashed lines! It's fast, but I feel I can deal with that. (-:

> Once it calibrates and runs the turtle slowly turns counterclockwise. That probably 'jitter' from how I
> pushed the direction pad.

> The machine is a HP pentium II running 450Mhz.
> The device is a microsoft sidewinder gamepad. Great for jazz jackrabit II and now logo!!!

> Thanks.

> Gary

--
===============================================================
George Mills

http://www.softronix.com
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------





Sat, 07 Jul 2001 03:00:00 GMT  
 LOGO-L> MSWLogo 6.4 and the JoyStick examples
Quote:
>Hope you don't mind my posting this reply.

I'm glad I could help you. I appreciate what you have done for us all.

You comment that the joystick is different from the gamepad gave me an idea. I can illustrate that the
gamepad IS different from a joystick by building a little program that prints the values of the controls as
you press them. I could then get into when one would be better than the other and how they make them so they
act in a similar but not the same way.

I'll probably do the program in toontalk. We've already played with the joystick sensors, doing much as I
described above. Playing with the joystick and gamepad in toontalk could then be followed up with playing
with a similar program in Logo. That's an illustration of two ways to do something.

Then we could go build a snow fort. (-:

Gary

Quote:

> Hope you don't mind my posting this reply.

> I appreciate your taking the time to get back to me.

> I've only tried one GamePad so far and it ran "Full Throttle" as soon as you
> touched the pad in any direction. I think that's basically how TouchPads
> work. The JoyStick.LGO example had a JoyStick in mind which allows you a wide range
> of control over speed and a wide range of control over the heading as well. But the example
> is usable with a GamePad but it is not as nearly fun as with a JoyStick. The
> fun part comes in when mixing different ratios of how fast your turning and how
> fast you moving forward which you can't do very well with a gamepad (i.e.
> small circles, big circles, spirals etc.).

> A more appropriate example could be written for a gamepad.

> You can slow it down by changing from

> localmake "TurnSensitivity  :elapse/150
> localmake "SpeedSensitivity :elapse/75

> to something like

> localmake "TurnSensitivity  :elapse/300
> localmake "SpeedSensitivity :elapse/150

> Remember this is just an example of how to use the gameport, there are an infinite number
> of possibilities of applying the GamePort to a Logo Application whether it be a GamePad,
> JoyStick, Thermo Couple device or what ever. Use your imagination of how you can map the
> GamePad controls to the functions you want to perform. The controls could be mapped to
> the parameters of any function.


> > >Someone mentioned they had problems with the JoyStick examples drawing
> > >dashed Lines.
> > (-:

> > I tried the new example and no dashed lines! It's fast, but I feel I can deal with that. (-:

> > Once it calibrates and runs the turtle slowly turns counterclockwise. That probably 'jitter' from how I
> > pushed the direction pad.

> > The machine is a HP pentium II running 450Mhz.
> > The device is a microsoft sidewinder gamepad. Great for jazz jackrabit II and now logo!!!

> > Thanks.

> > Gary

> --
> ===============================================================
> George Mills

> http://www.softronix.com
> The www page contains some very powerful educational software.
> Our single most important investment is our kids.
> ---------------------------------------------------------------




---------------------------------------------------------------





Sat, 07 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MSWLogo 6.4 problem

2. MSWLogo 6.4 problem

3. MSWLogo 6.4 problem

4. MSWLogo 6.4 problem

5. LOGO-L> Simpler MIDI Example for MSWLogo

6. LOGO-L> MSWLogo visual example

7. LOGO-L> Simple Math examples for MSWLogo

8. LOGO-L> PC-LOGO syntax in MSWLogo

9. LOGO-L> accessing a joystick

10. LOGO-L> Re: LOGO-L> Simple Math examples for MSWLogo

11. LOGO-L> Re: MSWLogo

12. LOGO-L> MSWlogo for D. Barnett

 

 
Powered by phpBB® Forum Software