RB ANDCOLOR

From MCS Wiki AVR
Jump to: navigation, search

Contents

Action

Ands specified color info to the specified LED in memory

 

 

Syntax

RB_ANDCOLOR Led , Color

 

 

Remarks

Color

Color is a byte array or variable that contains color information.

Led

The index of the LED number. First LED is 0.

 

The operation is performed on the memory. An AND operation can clear part of a color. You need to use RB_SEND so that the LED reflects the new color information.

 


See also

RB_ADDCOLOR , RB_ORCOLOR, RB_SUBCOLOR, RB_CLEARSTRIPE , RB_CLEARCOLORS , RB_FILL , RB_FILLCOLORS , RB_FILLSTRIPE , RB_SELECTCHANNEL , RB_SEND, RB_SETCOLOR , RB_SWAPCOLOR , RB_ROTATELEFT , RB_ROTATERIGHT , RB_SHIFTLEFT , RB_SHIFTRIGHT , RB_CHANGEPIN , RB_SETTABLECOLOR , RB_GETCOLOR , RB_LOOKUPCOLOR

Example

'-------------------------------------------------------------------------------
' rainbow_ws2812_Demo_Softblink.bas
'This demo show RB_OrColor and RB_AndColor which can be used
'for a flashing LED with a fade effect.
'-------------------------------------------------------------------------------
$Regfile = "m88pdef.dat"
$Crystal=8000000
$hwstack=32
$swstack=16
$framesize=32
Config RAINBOW=1, RB0_LEN=8, RB0_PORT=PORTB,rb0_pin=0
' ^ connected to pin 0
' ^------------ connected to portB
' ^-------------------------- 8 leds on stripe
' ^------------------------------------- 1 channel
 
Const Numled=8
Dim MASK as Dword
Dim Fade as Byte
 
'----[MAIN]---------------------------------------------------------------------
RB_SelectChannel 0 ' select first channel
 
Do
 For Fade = 0 to 7
 Waitms 20
 Shift MASK , left
 Incr MASK
 RB_ORColor 0 , MASK
 RB_Send
 Next
 For Fade = 0 to 7
 Waitms 20
 Shift MASK , right
 RB_ANDColor 0 , MASK
 RB_Send
 Next
Loop
Languages   English  
Personal tools
Namespaces
Variants
Actions
Navigation
Language