Quick Basic is a code writing program that can access different ports of the computer so that you can have both inputs and output singles along with code that reasons if things should be turned on or off. Q-Basic is a simple way of saying for saying Quick Basic which is the program we used though out the computer control class to do both our automated systems project along with all the small projects or demos that we did though out the semester. Below are some sample problems that we completed in Q-Basic.  
     
  Q-Basic Problems  
 

A. In a manner similar to that used in the FOR...NEXT statement, design a program using IF...THEN so that a delay of ten seconds is created. Once it is debugged, write the program:

CLS
A = 100
PRINT "Start"
TimeDelay:
A = A + 1
IF A < 1000000 THEN GOTO TimeDelay
Print "END"

 
 

B. Subroutines: Write a program with the following specifications:
1. It should ask four questions that require a YES or NO answer.
2. The answer to each question should be obtained using the INKEY$ statement, getting either a Y or N.
3. A subroutine using the GOSUB should be used to evaluate each answer.
4. If the answer is Y, the "YOUR ANSWER IS AFFIRMATIVE" should be printed to the monitor.
5. If the answer is Y, the "YOUR ANSWER IS NEGATIVE" should be printed to the monitor.
6. The program should ignore any keystroke which not a Y or N.

CLS
PRINT "Do you like apples?";
GOSUB Question1
PRINT "Do you like grapes?";
GOSUB Question1
PRINT "Do you like oranges?";
GOSUB Question1
PRINT "Do you like bananas?";
GOSUB Question1
END
Question1:
A$ = INKEY$
IF A$ <> "y" AND A$ <> "n" THEN GOTO Question1
IF A$ = "y" THEN PRINT "Your Answer Is Afirmative"
IF A$ = "n" THEN PRINT " Your Answer Is Negative"
RETURN

 
  C. Universal Stepper Motor Control Subroutine. Use the subroutine to control one stepper motor. Set the program up so that is asks the user how many steps and in what direction the motor is to turn.

x = -1

GOSUB Questions
steps = A: dir = B: GOSUB steproutine:
OUT 888, 0
END

steproutine:
cnt = 0
IF dir = 1 THEN GOTO LoopCCW
LoopCW:
IF cnt < steps THEN cnt = cnt + 1: x = x + 1
IF x = 4 THEN x = 0
OUT 888, 2 ^ x
FOR t = 1 TO 5000: NEXT
IF cnt < steps THEN GOTO LoopCW
RETURN
LoopCCW:
IF cnt < steps THEN cnt = cnt + 1: x = x - 1
IF x < 0 THEN x = 3
OUT 888, 2 ^ x
FOR t = 1 TO 5000: NEXT
IF cnt < steps THEN GOTO LoopCCW
RETURN
Questions:
A = 1
B = 1
INPUT "How many rev do you want?"; A
INPUT "What Direction? press 1 for CW and 0 for CCW"; B
A = A * 48
RETURN