Shop OBEX P1 Docs P2 Docs Learn Events
DS to BS2 project — Parallax Forums

DS to BS2 project

Kenny LevinsenKenny Levinsen Posts: 19
edited 2006-09-02 21:43 in Robotics
Well, i know how to make the hardware, but i need a quick way to perform the task that maches the pulse from the DS...
i dont want to make a long IF loop...
something like:
pulsin 0, 0, pls
goto (the pulse)


but that wouldnt work...
i

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The school nerd

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-03 21:36
    You're going to need to supply a little more detail. For instance, by "DS" I assume you mean a Nintendo DS. And when you say "matches the pulse from the DS", to what pulse are you referring?

    And the loop might look like:
    DS_Pin CON 0
    DS_Pulse VAR WORD

    MAIN:
    PULSIN DS_Pin, 0, DS_Pulse
    IF DS_Pulse > 500 THEN GOSUB Saw_Pulse ' I just picked 500 here...
    GOTO MAIN

    Saw_Pulse:
    ' ... Whatever
    RETURN
  • Kenny LevinsenKenny Levinsen Posts: 19
    edited 2006-08-04 11:05
    It's the IF loop i want to get rid of...
    by pulse i mean the control pulse sent by the Nintendo DS to the BS2 (dont know the length yet.... gonna make that later)

    IDEA: Can i somehow check if the pulse matches something in an array?
    like this (mockup command):
    [noparse][[/noparse]code]
    DO
    DO WHILE (IN0 = 0)
    something...
    LOOP
    pulsin 0, 0, start
    pulsin 0, 0, pls
    CheckArray pls, plsreg
    LOOP

    450:
    something for that pulse
    return

    500:
    something else...
    return

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The school nerd

    Post Edited (Kenny Levinsen) : 8/4/2006 11:18:15 AM GMT
  • Kenny LevinsenKenny Levinsen Posts: 19
    edited 2006-09-02 21:43
    I need help with serin
    i need to make it wait for the text "start" and then read to a var until it gets the text "stop".
    something like
    serin 0, 9600, (WAIT("start") WHILE (!stop) DEC input)
    

    ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The school nerd
Sign In or Register to comment.