ok here is my code:
CODE
' Whats a microcontroller project 2
' {$Stamp BS2}
' {$PBASIC 2.5}
x VAR Word
x = 3 'makes x start off at a middle stage
DO
IF IN3 = 1 THEN
x = x - 1
ENDIF
IF IN4 = 1 THEN
x = x + 1
ENDIF
DO
LOOP WHILE X = 1
PULSOUT 14, 500
PAUSE 10
PULSOUT 14, 1000
PAUSE 10
DO
LOOP WHILE x = 2
PULSOUT 14, 500
PAUSE 3
PULSOUT 14, 1000
PAUSE 3
DO
LOOP WHILE x = 3
PULSOUT 14, 500
PAUSE 2
PULSOUT 14, 1000
PAUSE 2
DO
LOOP WHILE x = 4
PULSOUT 14, 500
PAUSE 1
PULSOUT 14, 1000
PAUSE 1
DO
LOOP WHILE x = 5
PULSOUT 14, 500
PULSOUT 14, 1000
PAUSE 5
PULSOUT 14, 500
PULSOUT 14, 1000
PAUSE 5
LOOP
its meant to be a 6 speed wiper for a car and im doing it, i undertand how i can do it like in c++ which i am learning at the same time as welll, but i jsut dont under stand how to do it in BASIC.
here is my logic:
ok set x as 3
if it is 1: go slow
if 2: go slow + 1
and so son
if 6: fastest
i also need to design a pushbutton scheme to allow it to read in a 1
so there again my logic for that is:
if input = 1
change x to x-1 or x+1 depending on which button is pressed.
HELP WILL BE GREATLY APPRECIUATED
This post has been edited by dtgamer323: 24 Feb, 2008 - 06:03 PM