Shop OBEX P1 Docs P2 Docs Learn Events
Can you modulate LEDs with the BS2? — Parallax Forums

Can you modulate LEDs with the BS2?

edited 2005-03-23 03:52 in BASIC Stamp
Hi all, I am trying to make a program in which the speed of the Boe-Bot is determined inversely by the RCTIME function of the photoresistors. I am using the LEDs that come with the Boe-Bot as light sources. I know how to make the LED turn on or off (high PIN/low PIN), but is there a way to go in between for less light? Do I need a lot of LEDs to make this work?


This is the program that I'm running right now. It just turns the LED on and off and outputs the RCTIME.

' {$STAMP BS2}
' {$PBASIC 2.5}

timeleft VAR Word

DO


HIGH 8 'turns on LED
PAUSE 100

HIGH 6 'This sequence gets the RCTIME function
PAUSE 2
RCTIME 6,1,timeleft

DEBUG HOME, "timeleft = ", DEC5 timeleft 'Display RCTIME

PAUSE 500

LOW 8 'turns off LED
PAUSE 100

HIGH 6 'to get the RCTIME function
PAUSE 2
RCTIME 6,1,timeleft

DEBUG HOME, "timeleft = ", DEC5 timeleft 'Display RCTIME

PAUSE 500

LOOP

Comments

  • edited 2005-03-23 03:44
    Hello again,
    Can somebody please respond to my question? Even if it's a no, it will help me make a decision about what to do for my project.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-23 03:52
    You can control the brightness of an LED with PWM.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.