Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:iot-open:practical:hardware:rtu:esp32:scenarios:neopixel [2025/07/30 09:34] – created kivilands6en:iot-open:practical:hardware:rtu:esp32:scenarios:neopixel [2025/07/30 09:36] (current) kivilands6
Line 3: Line 3:
 <code> <code>
 #include <Arduino.h> #include <Arduino.h>
-#include <Adafruit_TinyUSB.h>+#include <Adafruit_NeoPixel.h>
  
-#include "OLED_Driver.h" +#define LED_PIN 12 
-#include "GUI_Paint.h" +#define LED_COUNT 8 
-#include "DEV_Config.h" + 
-#include "Debug.h" +Adafruit_NeoPixel strip(LED_COUNT, LED_PIN);
-#include "ImageData.h"+
  
 void setup() { void setup() {
-  System_Init(); +  Serial.begin(115200);
-  if(USE_IIC) { +
-    Serial.print("Only USE_SPI_4W, Please revise DEV_config.h !!!"); +
-    return; +
-  } +
-   +
-  Serial.print(F("OLED_Init()...\r\n")); +
-  OLED_1in5_rgb_Init(); +
-  Driver_Delay_ms(500);  +
-  OLED_1in5_rgb_Clear();   +
-   +
-  //1.Create a new image size +
-  UBYTE *BlackImage; +
-  Serial.print("Paint_NewImage\r\n"); +
-  Paint_NewImage(BlackImage, OLED_1in5_RGB_WIDTH, OLED_1in5_RGB_HEIGHT, 270, BLACK);   +
-  Paint_SetScale(65);+
  
-  while(1) { +  strip.begin(); 
-     +  strip.show();
-    // 2.Write directly to memory through the GUI  +
-    Serial.print("Drawing:page 1\r\n"); +
-    Paint_DrawPoint(20, 20, BLUE, DOT_PIXEL_1X1, DOT_STYLE_DFT); +
-    Paint_DrawPoint(40, 20, BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT); +
-    Paint_DrawPoint(60, 20, GRED, DOT_PIXEL_3X3, DOT_STYLE_DFT); +
-     +
-    Paint_DrawLine(10, 10, 10, 25, BLUE, DOT_PIXEL_1X1, LINE_STYLE_SOLID); +
-    Paint_DrawLine(30, 10, 30, 25, BLUE, DOT_PIXEL_1X1, LINE_STYLE_SOLID); +
-    Paint_DrawLine(50, 10, 50, 25, BLUE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); +
-    Paint_DrawLine(70, 10, 70, 25, BLUE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); +
-     +
-    Paint_DrawCircle(30, 90, 20, CYAN, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); +
-    Paint_DrawRectangle(15, 75, 45, 105, BROWN, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);    +
-    Paint_DrawCircle(80, 80, 25, BROWN, DOT_PIXEL_1X1, DRAW_FILL_FULL); +
-    Paint_DrawRectangle(65, 65, 95, 95, CYAN, DOT_PIXEL_1X1, DRAW_FILL_FULL); +
-    Driver_Delay_ms(2000);       +
-    OLED_1in5_rgb_Clear();  +
-     +
-    Serial.print("Drawing:page 2\r\n"); +
-    for(UBYTE i=0; i<16; i++){ +
-      Paint_DrawRectangle(0, i*8, 127, (i+1)*8, i*4095, DOT_PIXEL_1X1, DRAW_FILL_FULL); +
-    }      +
-    Driver_Delay_ms(2000); +
-    OLED_1in5_rgb_Clear();   +
-     +
-    Serial.print("Drawing:page 3\r\n");      +
-    Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, BLUE); +
-    Paint_DrawNum(10, 30, "123.4567", &Font12, 2, RED, BLACK);  +
-    Driver_Delay_ms(2000);     +
-    OLED_1in5_rgb_Clear();    +
-     +
-    Serial.print("Drawing:page 4\r\n"); +
-    OLED_1in5_rgb_Display_Part(gImage_1in5_rgb, 0, 0, 60, 60); +
-    Driver_Delay_ms(2000);     +
-    OLED_1in5_rgb_Clear();   +
- +
-    Serial.print("Drawing:page 4\r\n"); +
-    char myChar = 'A'; +
-    Paint_DrawChar(10, 0, myChar, &Font12, GREEN,  BLACK); +
-    Paint_DrawString_EN(10, 30, "jhinobili", &Font16, BLACK, BLUE); +
-    Paint_DrawNum(10, 50, "35252", &Font12, 2, RED, BLACK); +
-    Paint_DrawNum(10, 70, "4444", &Font12, 2, RED, BLACK); +
- +
-    Driver_Delay_ms(2000);     +
-    OLED_1in5_rgb_Clear();  +
- +
-  }   +
 } }
- 
 void loop() { void loop() {
 +  strip.clear(); 
 +  strip.setPixelColor(1,0,0,255); 
 +  strip.show(); 
 +  delay(1000); 
 +  strip.clear(); 
 +  strip.setPixelColor(6,0,0,255); 
 +  strip.show(); 
 +  delay(1500);
 } }
 </code> </code>
en/iot-open/practical/hardware/rtu/esp32/scenarios/neopixel.1753868091.txt.gz · Last modified: 2025/07/30 09:34 by kivilands6
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0