Can anyone help me to convert the following BASIC langauge into Visual Basic source code? Please help. I'm new in programming. Thanks alot.
-----------
NEW

10 REM Test Program Four - RG 9305.11
11 REM Walking Program for BORIS Connected to PC Parallel Port
12 REM Control from numeric keypad: UP arrow = Forward, etc.
13 REM
14 REM Send bits to the parallel port with LPRINT CHR$(Bits);
15 REM
16 REM Bits = 1*n + 2*n + 4*n + 8*n + 16*n + 32*n + 64*n + 128*n
17 REM
18 REM Bits equation sets bits ON if n = 1 or OFF if n = 0
19 REM First position (1*n) is bit 0
20 REM Last position (128*n) is bit 7
21 REM Calculate with each n to 1 or 0 for other output patterns
22 REM
23 REM Note: Ending semicolon (;) on LPRINT command holds
24 REM bit pattern at parallel port until next LPRINT
25 REM

30 DELAY = 350: REM Increase for slower walk, decrease for faster

40 PRINT "Press keypad arrow keys for Fwd, Back, Left, Right"
50 PRINT "Press space bar for Stop"
60 PRINT "Press Q at any time to Quit"

100 REM Stop walking
110 LPRINT CHR$(0); : GOSUB 1000: REM Clear All Bits
120 GOTO 100

200 REM Walk Forward
210 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
220 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
230 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
240 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
250 GOTO 200 300 REM Walk Reverse
310 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
320 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
330 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
340 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
350 GOTO 300

400 REM Rotate Left 410 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
420 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
430 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
440 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
450 GOTO 400

500 REM Rotate Right
510 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
520 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
530 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
540 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
550 GOTO 500


1000 REM Check Key Press and Do Delay Loop
1010 A$ = INKEY$
1020 IF A$ = " " THEN PRINT "Stop": LPRINT CHR$(0); : GOTO 100
1030 IF A$ = CHR$(0) + "H" THEN PRINT "Forward": LPRINT CHR$(0); : GOTO 200
1050 IF A$ = CHR$(0) + "P" THEN PRINT "Reverse": LPRINT CHR$(0); : GOTO 300
1060 IF A$ = CHR$(0) + "K" THEN PRINT "Left" : LPRINT CHR$(0); : GOTO 400
1070 IF A$ = CHR$(0) + "M" THEN PRINT "Right" : LPRINT CHR$(0); : GOTO 500
1080 IF A$ = "Q" OR A$ = "q" THEN LPRINT CHR$(0); : END

1100 FOR I = 1 TO DELAY
1110 NEXT I
1120 RETURN
1900 END

RUN
----------

You may send the source code to my email. Please help. Thanks alot.

so you want someone to convert this for you? Interesting request. Let me ask you what version on visual basic do you have right now?

where did you get he source code in BASIC from? Do you have the source files for it? If so post them. Makes it easier to convert.

Actually, I'm 1st year student majoring in Robotic. This BASIC code is used as a program to control a six legged robot called BORIS using parallel port. The program is to send set of bits to parallel port. The original source code is here http://www.musclewires.com/mwpb.html . And I'm a beginner in Visual Basic. I'm using Visual Basic.net. Maybe you can just write an simple code like how to send bits to the parallel port using VB.net in windows XP to me. Highly appreciate your kindness. Thanks a lot.

Sorry, Leon. It's going to take a lot more than a code translation to make this thing work. Direct access to the lprint chr$(number) command was last available in QBasic. Microsoft has taken away the ability to control the parallel port in VB. I hear there's some loopholes in the windows API so it's not impossible, but I haven't been able to make my parallel port work yet.

Search Amazon or the internet for a book called Parallel Port Complete by Jan Axelson. It has circuit diagrams and lots of vb code. It is about 330+ pages. If you are using the parallel port to controll things, you need this book!!!

John

This article has been dead for over six months. Start a new discussion instead.