{Nick's WS2811 Driver. Based on code from JonnyMac and info in P1 Manual. Loading this code to your P1 will set 50 pixels controlled by WS2811 to a color defined in "color" long. Data out on Pin 8. 2/7/2021 -loading the same code is sometimes random in the response. Not yet sure why. -working on incorporating the reset delay but unable to get that to work yet} CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 VAR byte cogids OBJ pst : "Parallax Serial Terminal" 'Use PST object PUB main cogids := cognew(@driver, 0) repeat DAT org 0 driver mov dira, Pin mov outa, reset setup mov npixs, npix next_pixel mov pixcol, color mov nbitss, nbits :loop rcl pixcol, #1 wc ' msb --> C if_nc mov t1, bit0hi 't1 is the delay cnts for the bit0 hi if_nc mov t2, bit0lo 't2 is the delay cnts for the bit0 lo if_c mov t1, bit1hi 't1 is the delay cnts for the bit1 hi if_c mov t2, bit1lo 't2 is the delay cnts for the bit1 lo xor outa, Pin add t1, cnt 'add current cnt t1, to turn t1 into a timer waitcnt t1, #0 'wait until t1 timer xor outa, Pin add t1, t2 'add t2 tp t1-timer waitcnt t1, #0 'wait until t1-timer djnz nbitss, #:loop 'loop for all 3 bytes djnz npixs, #next_pixel 'loop for each pixel ' add t1, resetd 'coding for reset and starting next data stream is not working yet. ' waitcnt t1, #0 'coding for reset and starting next data stream is not working yet. ' djnz npixs, #setup 'coding for reset and starting next data stream is not working yet. reset long $00_00_00_00 'used to reset outa to all 0s Pin long |< 8 'data signal on PIN 8 color long $00_10_10_00 'For WS2811 the 24 bit data is RR_GG_BB_xx bit0hi long 20 '20 cnts = 0.5/2 usec (half speed) bit0lo long 80 '80 cnts = 2.0/2 usec (half speed) bit1hi long 48 '48 cnts = 1.2/2 usec (half speed) bit1lo long 52 '52 cnts = 1.3/2 usec (half speed) nbits long 24 'number of bits per pixel npix long 50 'number of pixels 'resetd long 6000 '75 usec >= 50 usec timer res 1 pixcol res 1 t1 res 1 t2 res 1 npixs res 1 nbitss res 1 fit