Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,249 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,145 people online right now. Registration is fast and FREE... Join Now!




BASIC question

 
Reply to this topicStart new topic

BASIC question, BASIC programming task

dtgamer323
post 24 Feb, 2008 - 06:02 PM
Post #1


New D.I.C Head

*
Joined: 14 Dec, 2007
Posts: 10


My Contributions


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
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 10:32PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month