Wemos/Lolin 7x WS2812 RGB LED shield (HCWEMO0021)

Wemos ESP8266 based development boards and shields
Post Reply
admin
Site Admin
Posts: 879
Joined: Sun Aug 05, 2012 4:02 pm

Wemos/Lolin 7x WS2812 RGB LED shield (HCWEMO0021)

Post by admin » Fri Jul 14, 2023 2:19 pm

Image




A Wemos/Lolin D1 mini compatible shield featuring 7x WS2812 serial RGB leds. These are connected in series to digital pin D4 but can be changed via solderable jumper pads on the rear of the module. The shield comes with 2x 8 pin 0.1” pitch male headers supplied unsoldered.

For Arduino users this shield can be used with our HCWS2812 library.


Features:
7 RGB LEDs (WS2812B-mini) each with 24-bit RGB colour
9 optional control pins, Default: D4(GPIO2)



Example sketch
  1. // Include the ESP266WiFi.h library
  2. #include <ESP8266WiFi.h>
  3.  
  4. // Include the HCWS2812 library
  5. #include "HCWS2812.h"
  6.  
  7. // Create an instance of the library
  8. // Default pin for Wemos 7 LED shield is D4
  9. HCWS2812 HCWS2812();
  10.  
  11.  
  12.  
  13. void setup()
  14. {
  15.   /* The library requires very precise timing. Therefore WiFi needs to be disabled whilst  
  16.      updating the LEDs so that is doesn't get interrupted. */
  17.   WiFi.mode(WIFI_OFF);
  18.  
  19.   /* After you have updated the LEDs WiFi can be turned back on using one of the following modes:
  20.    * WiFi.mode(WIFI_AP);
  21.    * WiFi.mode(WIFI_STA);
  22.    * WiFi.mode(WIFI_AP_STA);
  23.    */
  24. }
  25.  
  26.  
  27. void loop()
  28. {
  29.   RGBBuffer[BLUE][0] = 0;
  30.   RGBBuffer[RED][0] = 255;
  31.   HCWS2812.Refresh();
  32.   delay(1000);
  33.  
  34.   RGBBuffer[RED][0] = 0;
  35.   RGBBuffer[GREEN][0] = 255;
  36.   HCWS2812.Refresh();
  37.   delay(1000);
  38.  
  39.   RGBBuffer[GREEN][0] = 0;
  40.   RGBBuffer[BLUE][0] = 255;
  41.   HCWS2812.Refresh();
  42.   delay(1000);
  43. }


Image

Library:
HCWS2812 library can be downloaded from the software section of this forum here: viewtopic.php?f=58&t=1799


Schematic (V1.0):
sch_rgb_led_v1.0.0.pdf

Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “WeMos”