How can I do that? Which pin is available for this?I am trying to controlled with my smart phone due to an application which i design,how can i import this part to my original program?
How can I do that? Which pin is available for this?I am trying to controlled with my smart phone due to an application which i design,how can i import this part to my original program?
Hi,
I haven't done any assembly level coding on the mbed platform, so the syntax will not be correct, but it should essentially be the same.
Have a look at this github page.
To drive the WS2812(B) you need to understand how it receives information.
First the WS2812(B) receives signals at a voltage relative to it supply voltage, this means that if you supply the strip with 5V you need to use a logical level of 5V at the input. This means that if you use the GPIO on the nRF51 you need to use a level shifter to get the correct logical output. If you supply the strip with it lowest rated voltage of 3.8V you might be fine with 3v3 logical level.
To transmit zero and one to the chip you use a proprietary timing protocol. This needs to be bit-banged(there has been some success with SPI for other chips).
Zero: Logical high for ~0.400µs then logical low for ~0.800µs
Pseudo code:
Set gpio high
nop //Wait one cycle
Set gpio low
One: Logical high for ~0.600µs then logical low for ~0.600µs
Pseudo code:
Set gpio high
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
Set gpio low
To describe the color of each LED you send a 24bit value to it, the colors are in the GRB format, i.e. 8bits for green, red and blue in that order. To adress the next led you simply send the next 24bits in. When you want to start from the first bit again you send zero on the line for 50µs.
Hopefully this clarifies things a bit.
Best regards,
Øyvind
Hi,
I haven't done any assembly level coding on the mbed platform, so the syntax will not be correct, but it should essentially be the same.
Have a look at this github page.
To drive the WS2812(B) you need to understand how it receives information.
First the WS2812(B) receives signals at a voltage relative to it supply voltage, this means that if you supply the strip with 5V you need to use a logical level of 5V at the input. This means that if you use the GPIO on the nRF51 you need to use a level shifter to get the correct logical output. If you supply the strip with it lowest rated voltage of 3.8V you might be fine with 3v3 logical level.
To transmit zero and one to the chip you use a proprietary timing protocol. This needs to be bit-banged(there has been some success with SPI for other chips).
Zero: Logical high for ~0.400µs then logical low for ~0.800µs
Pseudo code:
Set gpio high
nop //Wait one cycle
Set gpio low
One: Logical high for ~0.600µs then logical low for ~0.600µs
Pseudo code:
Set gpio high
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
nop //Wait one cycle
Set gpio low
To describe the color of each LED you send a 24bit value to it, the colors are in the GRB format, i.e. 8bits for green, red and blue in that order. To adress the next led you simply send the next 24bits in. When you want to start from the first bit again you send zero on the line for 50µs.
Hopefully this clarifies things a bit.
Best regards,
Øyvind