Serial Toolbox icon Serial Toolbox — EZB UART parser and Serial-TCP bridge to connect EZ-Robot cameras via Teensy USB, enabling ARC camera control and USB-to-serial bridging. Try it →

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

#1  

Yes, you can use PWM to control the brightness of an LED, so a script that ramps up and down the pwm going to the digital port will do it.

Alan

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#2  

Use the ServoSpeed() command to apply a ramping speed to the PWM. And as alan mentioned, use the PWM command to set the brightness.

Something like this...


# set the servo speed to 2
ServoSpeed(d0, 2)

:loop

# Set LED On
pwm(d0, 100)

# wait some time for the pwm to do its ramping thing
sleep(3000)

#set LED Off
pwm(d0, 0)

# wait some time for the pwm to do its ramping thing
sleep(3000)

goto(loop)

#3  

I figured it might be through the servo controller. Seeing the code is very helpful. Thanks for the fast response, guys!

#4  

Oh, good one DJ. I didn't think about using the PWM ramping built into Servospeed.

I did this script (D11 is my LED)


$brightness = 0
repeatwhile($brightness) <= 100)
  PWM(D11,$brightness)
$brighness = $brightness + 1
Sleep(150)
endrepeatwhile

(this just ramps up, not back down).

#5  

@Science Bob.... Next time ask us something really challenging will ya.... LOL

Welcome to ez robot, btw.... :)