First timer...building a remote controlled vehicle


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Have one side of the button connected to 5 volts, the other to the PIC pin. Have a 10 k resistor connected to the same PIC pin and ground (zero).

    When the button is pushed ( assuming it is NO ) the PIN pin will be forced HIGH, that is 1.
    Code:
    IF PORTA.1 = 1 THEN LABEL
    Being this sounds like a school project, can you tell me why the below worked?
    Code:
    SERIN2 PORTC.1,396,[WAIT("9"),STR MOVEMENT\2]
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jan 2009
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    I am assuming that it "waited" to receive a digit of 9, then the array of 2 movement split the next 2 incoming bytes into the array.

    That part worked if afterward I did a check on what digit was sent (in this case, a 1), and then if it was a 1, to turn the pin porta.1 high. This worked and turned an LED i had put there on. Buttttt, when I did the same thing with the following if then statements...it did not work:

    Code:
    ;lets get moving!
    checkdirection:
    ;forward and backwards
    if direction = 0 then
    goto checkturns 
    if direction = 1 THEN 
    goto forward
    if direction = 2 then 
    goto backward
    endif
    endif
    endif
    
    checkturns:
    ;forward and backwards
    if turns = 0 then
    goto start 
    
    start_turn: 
    if turns = 1 THEN 
    goto turnleft
    if turns = 2 then 
    goto turnright
    endif
    endif
    endif
    goto start
    
    ;left and right turns
    forward:
    if turns = 0 then
    goto forwardgo
    if turns = 1 THEN 
    goto forwardleft
    if turns = 2 then
    goto forwardright
    endif
    endif
    endif
    
    forwardgo:
    high forwardl
    high forwardr
    pause 500
    low forwardl
    low forwardr
    
    goto start
    I am not sure why it would not work...

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 18:39
  2. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 02:59
  3. TV remote controlled RGB LEDs
    By idtat in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd February 2009, 18:15
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2009, 00:49
  5. Need help building a simple IR learning remote with a PIC
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 20th April 2006, 23:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts