Shop OBEX P1 Docs P2 Docs Learn Events
Problems with my BS2 — Parallax Forums

Problems with my BS2

Agent CobaltAgent Cobalt Posts: 88
edited 2005-11-12 16:57 in BASIC Stamp
Before I begin, thank you to anyone who helps me out. I'm using a TAB robot kit for my engineering final project. It has 7 LEDs, and an output to an LM386 audio amplifier. I wrote code to blink the LEDs on and off pseudo-randomly as the Stamp is outputting a simple Christmas tune. The problem is, the LEDs are behaving rather strange and in a matter that is unwanted. Two of the LEDs are bi-color. Here's what's happening. The LEDs are blinking on and off randomly, but their intensity is varying randomly as well. The two bi-color LEDs are switching colors (unwantedly) and varying their intensity as well. I've tried disconnecting some of the LEDs (current draw) as well as the amplifier circuit, but the LEDs keep behaving the same way. I'm also using a 470 ohm LED. If anyone can offer any help, it would be appreciated as the presentation of our projects is in 7 hours and I need sleep beforehand.

LED Flasher code:
rndVal   VAR     Byte

Init:
  OUTL = %00000000
  DIRL = %11111111

Main:
  RANDOM rndVal
  OUTL = rndVal // 128
  PAUSE 250
  GOTO Main


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truth can be dangerous... Trust can be deadly.

Comments

  • ForrestForrest Posts: 1,341
    edited 2005-11-12 06:10
    Try disconnecting the 2 motor drive cables and install a fresh set of batteries. I don't think you'll be able to run more than 5 LED's (assuming typical current draw of 20 mA each).
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-12 09:03
    Agent Cobalt -

    Adding to what Forrest has already said (my presumption as well - power supply problem), you might consider adding a separate power supply (additional battery pack), remembering to connect both grounds together, and use that for powering your LED's.

    Regards,

    Bruce Bates
  • metron9metron9 Posts: 1,100
    edited 2005-11-12 14:22
    Before tearing it apart, try reprogramming to a known blinking pattern
    blink 1 led on and off for a few seconds
    then 2 then 3 etc...

    If its power, this will show

    Also , I am not familiar with the robot, but if you wired your LED's do they all have their own resistors?
    Perhaps the LED wiring is not correct.
  • Agent CobaltAgent Cobalt Posts: 88
    edited 2005-11-12 16:57
    Yeah. It was definitely power issues. So I programmed the robot to cycle through programmed patterns in which only 3 lights were on at a time. And the project was a nice success at the presentation this morning so thanks for feedback on possible things to check for. If it wouldn't have been 2 or 3 in the morning, I probably would've figured that out, but I was just too tired of spending so much time on it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truth can be dangerous... Trust can be deadly.
Sign In or Register to comment.