Creating Arduino Library for WS2812B LED Strip

  Рет қаралды 6,584

Anas Kuzechie

Anas Kuzechie

Күн бұрын

Пікірлер: 12
@dl8cy
@dl8cy 2 жыл бұрын
Nice to see that how bricks are made and brick comes to brick to finish some day the house or city - thank you
@AnasKuzechie
@AnasKuzechie 2 жыл бұрын
Thanks Mike
@bk_electronics
@bk_electronics 2 ай бұрын
Parabéns pelo vídeo explicativo meu amigo
@AnasKuzechie
@AnasKuzechie 2 ай бұрын
Thank you.
@janetsypen9913
@janetsypen9913 2 жыл бұрын
Thank you for this Lib. I am going to try to adapt to Attiny85. Question : I understand the assembly however if I understand the code ,the "C" code sends bytes to the assembly code and as such could this not expose the timing to how the compiler handles the code in between bytes? If there is a excessive delay between bytes would this cause an error as the Ws2812 is looking for a continuous 24 bit wave train with specific timing requirements. I expect code modified for 8 MHZ would be more susceptible. Once I convert to Attiny85 I will check timing with an oscilloscope. Also what is the code size compared to other library's like neopixel and lite_ws2812? I expect it to be much more compact. Love your tutorials !
@AnasKuzechie
@AnasKuzechie 2 жыл бұрын
Thanks for your feedback. Timing shouldn’t be an issue, since after compilation, code is stored in hex code. So when the controller is powered, machine code is executed during run time. As for size, my library is small compared to existing ones, and I’ll try to update by adding more functionalities. Keep in mind my tutorials are for educational purposes. Thanks again.
@bob-ny6kn
@bob-ny6kn 2 жыл бұрын
When calling ASM functions from C, would you consider prefixing the function calls with "asm" for example asmColor(0,0,255); when calling for an LED to be 100%blu. Also, do you use "keywords.txt" in your project to turn "color" function name orange? I extended your initial 3 pixels to "n" and found timing became an issue in "high pulse" of "Logic0" and "Logic1"... see where I edited your .S file, showing timing at 0.0625us/cycle. The "high pulse" timing makes a large difference in color: Logic0: // (0.40us + 0.85us = 1.25us) ;-------------------------- ;0.40us high pulse (6T) ;---------------------- OUT PORTD, R30 ;set DIN pin HIGH NOP // 2 timing cycles NOP // 3 timing cycles NOP // 4 timing cycles NOP // 5 timing cycles NOP // 6 timing cycles * 0.0625 = 0.375 ;---------------------- ;0.85us low pulse (14T) ;---------------------- OUT PORTD, R31 ;set DIN pin LOW NOP // 2 timing cycles NOP // 3 timing cycles NOP // 4 timing cycles NOP // 5 timing cycles NOP // 6 timing cycles NOP // 7 timing cycles NOP // 8 timing cycles NOP // 9 timing cycles NOP // 10 timing cycles NOP // 11 timing cycles NOP // 12 timing cycles ; NOP // 13 timing cycles // for ease of including timing cycles 13 and 14 RET // 13 timing cycles * 0.625 = 0.8125 (+ 0.375 = 1.125) ;---- ; RET // 14 timing cycles * 0.0625 = 0.875 (+ 0.375 = 1.25) ;==================================================================== Logic1: // (0.80us + 0.45us = 1.25us) ;--------------------------- ;0.80us high pulse (13T) ;----------------------- OUT PORTD, R30 // 1 timing cycle NOP // 2 timing cycles NOP // 3 timing cycles NOP // 4 timing cycles NOP // 5 timing cycles NOP // 6 timing cycles NOP // 7 timing cycles NOP // 8 timing cycles NOP // 9 timing cycles NOP // 10 timing cycles NOP // 11 timing cycles NOP // 12 timing cycles * 0.0625 = 0.75... expected drop in pixel intensity ; NOP // 13 timing cycles * 0.0625 = 0.8125 ... sharp drop in pixel intensity ;--------------------- ;0.45us low pulse (7T) ;--------------------- OUT PORTD, R31 // 1 timing cycle NOP // 2 timing cycles NOP // 3 timing cycles NOP // 4 timing cycles NOP // 5 timing cycles NOP // 6 timing cycles ;---- RET // 7 timing cycles * 0.0625 = 0.4375 (+ 0.75 = 1.1875)
@MatanSpada
@MatanSpada 2 жыл бұрын
Is is possible to to write this specific assembly code in C? If it's possible, how can I do that without knowing assembly?
@AnasKuzechie
@AnasKuzechie 2 жыл бұрын
Hi. I tried in C but no success since generating a pulse less than 1 us is difficult in C but easy in assembly. Thanks for your feedback.
@bob-ny6kn
@bob-ny6kn 2 жыл бұрын
Maybe use inline asm? Reference this PDF: web.stanford.edu/class/ee281/projects/aut2002/yingzong-mouse/media/GCCAVRInlAsmCB.pdf
@webenterR
@webenterR 2 жыл бұрын
How to make it work for ESP8266? ((
@sanjaykhurana3400
@sanjaykhurana3400 Жыл бұрын
Wire 3. Two wire pawer one wire data
Creating Arduino Library for HC-SR04 Sensor
7:56
Anas Kuzechie
Рет қаралды 2,3 М.
TUTORIAL NODEJS DASAR (BAHASA INDONESIA)
3:48:04
Programmer Zaman Now
Рет қаралды 560 М.
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3,1 МЛН
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 49 МЛН
FM / RDS  receiver with RDA5807, Arduino Nano and Nokia 5110 display
1:15
What’s Behind the Light? - How WS2812B LED Strips Work
20:45
Intermation
Рет қаралды 53 М.
STM32 LED Strip (WS2812b) control 1: Theory and implementation
11:12
HOW TO USE WS2812B NEOPIXELS WITH FASTLED ON ARDUINO
24:32
Gadget Reboot
Рет қаралды 183 М.
Creating Arduino Library for 74HC595 Display
14:17
Anas Kuzechie
Рет қаралды 6 М.
Wiring considerations for WS2812B RGB LEDs
8:40
learnelectronics
Рет қаралды 22 М.
How To Control WS2812B Individually Addressable LEDs using Arduino
9:31
How To Mechatronics
Рет қаралды 1,1 МЛН
#BB11 Create an Arduino Library😨 - A Real World Example (Easy)
25:54
How to use WS2812 “NeoPixel” LEDs with a PIC microcontroller
12:35
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3,1 МЛН