This is essentially an SPI device. This means you send a stream of three bytes to control the color and a small wait to allow the chip to process the bytes.
There is a lot of example code on the internet and converting to Great Cow BASIC is not a challenge.
What level of coder are you?
Which microcontroller are you planning to use?
Is the only device you plan to connect to the microcontroller ?
And, have you seen some code or a Youtube video that shows what the end goal should be?
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the response. I am just starting out on the Arduino Uno. Basically I want to vary the colors in a loop going through different fades and mixes. Nothing really in mind other than learning how to do it. Any code reference for SPI I should look at?
Thanks!
Nick
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your code needs to look something like this. This is not tested - so, your task is to decompose and make it work. :-)
Lookup in the Help SPIMODE and SPITransfer, also,
Look at the demos for a demo program called \GreatCowBasic\Demos\SPI Digital Pot Solutions\MCP4xxx SPI Pot\MCP4141_HardwareSPI_SimpleDemo_mega328p@16.gcb this has the same chip and working code for an SPI solution.
Do not hestitate to ask questions.
I hope this get you started.
Anobium
PS. When you get it going... I want the program back to publish as an demo!!
:-)
~~~~~
'''A program for GCGB and GCB.
'''
'''@author
'''@licence GPL
'''@version
'''@date
'''**************
; ----- Constants
' Four ports are required for HW SPI but we are only use two - data out and clock lines
' #define WS2812_CS DIGITAL_10
#define WS2812_SCK DIGITAL_13
#define WS2812_DO DIGITAL_11
' #define WS2812_DI DIGITAL_12
Hello,
I am looking for a library or sample code for controlling a string of serial RGB LEDS. I would appreciate the help!
It uses a type of manchester code per bit. WS2812 sold on Adafruit.
Thanks!
Nick
Last edit: Macgman2000 2016-06-29
Hi Nick and welcome,
This is essentially an SPI device. This means you send a stream of three bytes to control the color and a small wait to allow the chip to process the bytes.
There is a lot of example code on the internet and converting to Great Cow BASIC is not a challenge.
What level of coder are you?
Which microcontroller are you planning to use?
Is the only device you plan to connect to the microcontroller ?
And, have you seen some code or a Youtube video that shows what the end goal should be?
Anobium
Hi Anobium,
Thanks for the response. I am just starting out on the Arduino Uno. Basically I want to vary the colors in a loop going through different fades and mixes. Nothing really in mind other than learning how to do it. Any code reference for SPI I should look at?
Thanks!
Nick
Your code needs to look something like this. This is not tested - so, your task is to decompose and make it work. :-)
Lookup in the Help SPIMODE and SPITransfer, also,
Look at the demos for a demo program called \GreatCowBasic\Demos\SPI Digital Pot Solutions\MCP4xxx SPI Pot\MCP4141_HardwareSPI_SimpleDemo_mega328p@16.gcb this has the same chip and working code for an SPI solution.
Do not hestitate to ask questions.
I hope this get you started.
Anobium
PS. When you get it going... I want the program back to publish as an demo!!
:-)
~~~~~
'''A program for GCGB and GCB.
'''
'''@author
'''@licence GPL
'''@version
'''@date
'''**************
; ----- Configuration
#chip mega328p, 16
#include <uno_mega328p.h></uno_mega328p.h>
; ----- Constants
' Four ports are required for HW SPI but we are only use two - data out and clock lines
' #define WS2812_CS DIGITAL_10
#define WS2812_SCK DIGITAL_13
#define WS2812_DO DIGITAL_11
' #define WS2812_DI DIGITAL_12
; ----- Define Hardware settings
' None
; ----- Variables
dim loopx as word
; ------ Start of main Program
; ----- Example code
Sub WS2812Init
SPIMode MasterFast, 0
' Dir WS2812_DI in
Dir WS2812_DO Out
Dir WS2812_SCK Out
' Dir WS2812_CS out
End Sub
Sub WS2812WriteLEDs ( in LEDValue as long, in NumberofLEDs )
End Sub
Thanks for the starter code :) I will post back when I get things sorted.
Nick
THIS POSTING/CODE HAS BEEN SUPERCEDED. PLEASE LOOK AT THE DEMONSTRATIONS FOR WORKING CODE.