Additional information.
If I put omega2-ctrl gpiomux set pwm0 pwm
in a script.sh file and run it then I get the following message:
unknown group/function combination
.
Does anybody has an idea how to resolve this issue?
Posts made by LaurentN
-
RE: Permanent gpiomux - configuration after boot
-
Permanent gpiomux - configuration after boot
Hi.
I want to setup a permanent gpiomux configuration on my omega2.
At the moment I have to enter at every boot the following command to setup my gpio configurationomega2-ctrl gpiomux set pwm0 pwm
I tried to put this line into the '/etc/rc.local' file without success.
My question is how to configure this gpiomux settings in a way that after a reboot the configuration is available?
Thanks
-
RE: WS281x, SK6812 driver for the Omega2? [Solved]
Re: [WS281x](SK6812 driver for the Omega2? [Solved])
Hi.
In the last days I played a bit with Python to get the WS281x working wirth Luz' module.
As I want to use HLS color schema (it allows to change the luminosity of the color by only one number), I programmed a function HLS to RGB color string:def hls2rgb(h,l,s): r, g, b = colorsys.hls_to_rgb(h,l,s) shr = str(hex(int(r * 255.0))) shg = str(hex(int(g * 255.0))) shb = str(hex(int(b * 255.0))) # print ([int(255.0*r), int(255.0*g), int(255.0*b)]) if len(shr) == 3: shr = shr[0:2] + str(0) + shr[2] if len(shg) == 3: shg = shg[0:2] + str(0) + shg[2] if len(shb) == 3: shb = shb[0:2] + str(0) + shb[2] col_led_string = shr[2:4].decode('hex') +shg[2:4].decode('hex') + shb[2:4].decode('hex')
By using the following additional function, it allows using a 2 dimensional color matrix which is converted in the corresponding hex color string needed for the module. (It might be useful and easier to use a matrix to handle LED chains instead of a string of hexadigitals)
def hls2rgb_hexstring(hls_matrix): dim1 = len(hls_matrix) try: dim2t = len(hls_matrix[0]) except: dim2t = 0 if dim2t == 0: dim2 = dim1 dim1 = 1 else: dim2 = dim2t if dim1 == 1: h = hls_matrix[0]/360.0 l = hls_matrix[1]/100.0 s = hls_matrix[2]/100.0 col_led_string = hls2rgb(h,l,s) return col_led_string else: col_led_string="" for i in range(0,dim1): h = hls_matrix[i][0]/360.0 l = hls_matrix[i][1]/100.0 s = hls_matrix[i][2]/100.0 col_led_string = col_led_string + hls2rgb(h,l,s) return col_led_string
To display a color gradient among several LED's (here 40) one has to run this code, which is using both function above:
color_start = 0 color_end = 359 nr_led = 40 lum = 2 sat = 100 colorMatrix = [] for i in range(color_start,color_end, abs(color_end-color_start)/nr_led): colorMatrix.append([i,lum,sat]) #print [i,lum, sat] print colorMatrix with open('/dev/ledchain0','w') as export: export.write(hls2rgb_hexstring(colorMatrix))
-
RE: WS281x, SK6812 driver for the Omega2? [Solved]
Thanks Luz for this explanation.
I forgot that HSL values could be transformed into the RGB values.I used python to control the 8 LED ring (WS2812b) using code like
with open('/dev/ledchain0','w') as export: export.write(col_string)
where
'col_string'
is a a text string containing all the RGB values for the hole ring.
However sometimes (especially when I have to calculate the RGB values and then compose the string), I get an error 'ValueError: invalid \x escape'Maybe this isn't the best way to control the LED with python and you can advise a better one.
Regards
-
RE: WS281x, SK6812 driver for the Omega2? [Solved]
Hi
I'm wondering if (and how) it is possible to dim the LED with the p44-ledchain module? (keyword: change of duty cycle)
Regards
Laurent -
PWM available on which dock?
Hi.
I'm wondering on which boards the PWM function is available?
Mainly I'm interested if I can use PWM on the power board and mini dock.Regards