M150
Back to the Gcode Dictionary
M150: Set LED colours
Parameters
- Rnnn Red component, 0-255
- Unnn Green component, 0-255
- Bnnn Blue component, 0-255
- Wnnn White component, 0-255 (Only for RGBW NeoPixel, RepRapFirmware 3.3 and later)
- Pnnn Brightness, 0-255 (RepRapFirmware 2.03 and later)
- Snnn Number of individual LEDs to set to these colours
- Fn Following command action. F0 (default) means this is the last command for the LED strip, so the next M150 command starts at the beginning of the strip. F1 means further M150 commands for the remainder of the strip follow this one.
- Xn LED type: X0 = DotStar (default prior to RRF 3.2), X1 = RGB NeoPixel (default in RRF 3.2 and later), X2 = bit-banged RGB NeoPixel, X3 = RGBW NeoPixel (from RRF 3.3), X4 = bit-banged RGBW NeoPixel (from RRF3). This parameter is remembered from one call to the next, so it only needs to be given once. Not all boards support all the modes. On the Duet 3 Mini, X1 and X3 select the NeoPixel output on the main board, while X2 and X4 address the RGB LEDs on some 12864 displays.
- Ynn 'Brightness, 0-31 (alternative to P 0-255)
- Qnnn (optional) Use specified SPI frequency (in Hz) instead of the default frequency. This parameter is not normally needed, and is only processed if X parameter also present. When using NeoPixels, only frequencies in the range 2.4 to 4MHz will work.
Example
M150 X1 Q3000000 ; set LED type to NeoPixel and set SPI frequency to 3MHz M150 R255 P128 S20 F1 ; set first 20 LEDs to red, half brightness, more commands for the strip follow M150 U255 B255 P255 S20 ; set next 20 LEDs to cyan, full brightness, finished programming strip
This command is only supported on controllers that have an output connector for DotStar or NeoPixel LEDs.
The specified RGB values will be sent to the number of LEDs in the LED strip as specified by the S parameter, pushing the existing colours along the strip. To set all the LEDs the same colour, make the S parameter equal to or a little longer than the number of LEDs in the strip.
Оn Fysetc 12864mini you can configure all three LEDs separately. For display and for encoder illumination:
Example
M918 P2 E-4 F2000000 ; Fysetc 12864mini M150 X2 R255 U0 B0 P255 S1 F1 ; display led M150 X2 R0 U255 B0 P255 S1 F1 ; left encoder led M150 X2 R0 U255 B0 P255 S1 F0 ; right encoder led
One Comment
On my fysetc12864 R-green, U-red
It would be nice to add that on fysetc12864 you can configure all three LEDs separately. For display and for encoder illumination.
M918 P2 E-4 F2000000 ; Fysetc 12864mini
M150 X2 R255 U0 B0 P255 S1 F1 ; display led
M150 X2 R0 U255 B0 P255 S1 F1 ; left encoder led
M150 X2 R0 U255 B0 P255 S1 F0 ; right encoder led
Vladimir - Reply