Shop OBEX P1 Docs P2 Docs Learn Events
Help with Whiskers — Parallax Forums

Help with Whiskers

travisbtravisb Posts: 2
edited 2013-01-26 22:24 in BASIC Stamp
I CANT get the whiskers to function for the boe-bot. I know I have everything wired correctly. I've been over the code several times and cant find a error. The whiskers against the 3 pins are testing ok. Can anyone help?

DEBUG "PROGRAM RUNNING"
pulseCount VAR Byte
FREQOUT 4, 2000, 3000
DO
IF (IN5 = 0) AND (IN7 = 0) THEN
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
ELSEIF (IN5 = 0) THEN
GOSUB Back_Up
GOSUB Turn_Right
ELSEIF (IN7 = 0) THEN
GOSUB Back_Up
GOSUB Turn_Left
ELSE
GOSUB Forward_Pulse
ENDIF
LOOP
Forward_Pulse:
PULSOUT 13,850
PULSOUT 12,650
PAUSE 20
RETURN
Turn_Left:
FOR pulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
RETURN
Turn_Right:
FOR pulseCount = 0 TO 20
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Back_Up:
FOR pulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN

Comments

  • RDL2004RDL2004 Posts: 2,554
    edited 2012-03-22 11:10
    Hi,

    Did you ever get this working? Since I don't actually have a Boe-Bot set up right now, I hooked up a couple of continuous rotation servos on a BoE with a BS2 and wired some push button switches in place of the whiskers. When I ran your code everything seemed to work correctly. The servos ran and changed directions as the switches were pressed, though I can't really say if an actual Boe-Bot would move as you expected.
  • travisbtravisb Posts: 2
    edited 2012-03-22 13:01
    No, didn't get it working. I'm stuck. So I guess if the code is working - then I don't really know what to do next. This is my first robot project. I tried to skip the project and move on the the next (photoresistors) but I cant seem to get that working either. I'm thinking there is a problem with the board itself.
  • RDL2004RDL2004 Posts: 2,554
    edited 2012-03-22 13:23
    Well, the most common problems are power and connections.

    I would go back and redo the wiring (make sure you're using the right resistors), and if you're using batteries, make sure they're new.

    It's a good idea to use a wall adapter instead of batteries when testing stuff on the Boe-Bot, then switch to batteries once you're sure it's working right. You can set the 'bot on a small box or block of wood or something so it doesn't run all over the place while testing.
  • nrsmacnrsmac Posts: 42
    edited 2012-03-23 14:16
    Upload a pic and schematic (via Fritzing) of your wiring. From there, we will be able to debug further.
  • jrperatajrperata Posts: 3
    edited 2013-01-26 16:20
    I have the EXACT same problem. The other problem is for the GOSUB Turn_Right part of the code, it errors with "undefined label ". Have you or anyone found a solution to this yet?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-26 16:32
    If you get an undefined label with GOSUB Turn_Right, then you're missing the label for Turn_Right. Compare your code with sample code that's known to work.

    If you have the EXACT same problem, then read what's been suggested so far and follow the suggestions (like those from nrsmac).
  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-26 16:41
    As with any problem where a program seems not to do what you think it should, add some debugging statements. Add DEBUG statements after each label (like DEBUG "Forward_Pulse",CR) after the Forward_Pulse label and the same sort of thing after each of the other labels. Add a descriptive DEBUG statement after each IF or ELSEIF or ELSE statement. See what happens when the whiskers are not pressed. See what happens when you press each whisker, one at a time. Compare with what you think the program should be doing. Obviously, you have to have the BoeBot connected to your PC while this is going on. Put it up on a block so the wheels don't contact the floor or desktop.
  • jrperatajrperata Posts: 3
    edited 2013-01-26 17:21
    hi...did travisb upload a pic and schematic? we both have the same problem and I didn't see a reply. Can I also send a picture of my wiring......i checked this several times, so, I am wondering if there is an error with the schematic in the book
  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-26 22:24
    If you don't see a picture and/or schematic, there isn't any. Presumably travisb never replied. I don't believe there's an error in the schematic in the book.

    I have Robotics with the BoeBot V2.2 and I've looked at Figure 5-4 on page 168 and Figure 5-5 on page 169 and they both look correct. Sometimes the breadboard can have bad connections where a group of 5 holes is normally connected together. Check the voltage at the Stamp pin. It should be near 5V when the whisker switch is open (not touching) and near 0V when the whisker switch is closed.
Sign In or Register to comment.