Submitted by mlsmith on Fri, 03/11/2016 - 16:51
Can LED's be controlled via the ultra board?
I've been looking for an i2c board that can control one or Ultrasound distance modules and three or four LED's.
Also, can we get the boards without the pin headers to lower the price?
Thanks!
Mike
piborg
Mon, 03/14/2016 - 11:40
Permalink
Controlling LEDs using UltraBorg
It is possible to control LEDs using the servo outputs.
What you will need to do is connect the LED and an appropriate resistor for 5V operation between the
+andSpins on the servo connection.In order to control the LED properly you will need to use the
CalibrateServoPositionXcalls to override the normal behaviour.BE VERY CAREFUL DOING THIS, using these calls with a servo attached may cause permanent damage to the servo itself.
When using the
CalibrateServoPositionXfunctions a value of0will be full brightness, a value of0xFFFFwill be fully off.We can make a function to simplify things like this:
def SetLed1(brightness): if brightness > 1.0: brightness = 1.0 elif brightness < 0.0: brightness = 0.0 pwmLevel = 0xFFFF * (1.0 - brightness) UB.CalibrateServoPosition1(pwmLevel)The same can be done for outputs 2 to 4.
The functions can be used like this:
Unfortunately all of the UltraBorgs we have in stock are fully assembled so we cannot sell them without the headers fitted.