Reading the Games Port in MSW Logo cont ...
The procedure outlined below reads the first line of the Games Port (ie data line zero with the function "InGamePort 1"). The result is displayed as a moving 'needle' simulating an analogue "meter". Buttons are used to Start, Stop and Close the procedure. The actual value read is also displayed as the label on one of the buttons.
The on-screen display appear as ...

The code for the procedures is:
| to control ; Written by Jim Fuller October 1999 ; See - http://www.southwest.com.au/<tilde>jfuller/gameport/gameport.htm scale make "control 1 ; The variable "control" is used to start and stop input. windowcreate "main "mywindow "Meter 10 50 50 150 [] ; Creates a sub-window called "Meter" ; NOTE: You can remove this window on closing with a ; <windodelete "mywindow> comand. ; NOTE - The "[]" is a left/right square bracket. It is essential! buttoncreate "mywindow "Start "Start 5 20 35 12 [do.until [meter1][:control = 0]] buttoncreate "mywindow "Stop "Stop 5 50 35 12 [make "control 0] ; The lines above set up the eight individual control buttons. buttoncreate "mywindow "Close "Close 5 120 35 10 [windowdelete "mywindow] ; This line closes the sub-window opened in the fourth line. end to meter1 to move to scale |