This shows you the differences between two versions of the page.
| en:iot-open:practical:hardware:rtu:esp32:scenarios:neopixel [2025/07/30 09:34] – created kivilands6 | en:iot-open:practical:hardware:rtu:esp32:scenarios:neopixel [2025/07/30 09:36] (current) – kivilands6 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| < | < | ||
| #include < | #include < | ||
| - | #include <Adafruit_TinyUSB.h> | + | #include <Adafruit_NeoPixel.h> |
| - | #include " | + | #define LED_PIN 12 |
| - | #include " | + | #define LED_COUNT 8 |
| - | #include " | + | |
| - | #include " | + | Adafruit_NeoPixel strip(LED_COUNT, |
| - | #include " | + | |
| void setup() { | void setup() { | ||
| - | | + | Serial.begin(115200); |
| - | if(USE_IIC) { | + | |
| - | | + | |
| - | return; | + | |
| - | } | + | |
| - | + | ||
| - | Serial.print(F(" | + | |
| - | OLED_1in5_rgb_Init(); | + | |
| - | Driver_Delay_ms(500); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | //1.Create a new image size | + | |
| - | UBYTE *BlackImage; | + | |
| - | Serial.print(" | + | |
| - | Paint_NewImage(BlackImage, | + | |
| - | Paint_SetScale(65); | + | |
| - | | + | |
| - | + | | |
| - | // 2.Write directly to memory through the GUI | + | |
| - | Serial.print(" | + | |
| - | | + | |
| - | Paint_DrawPoint(40, | + | |
| - | Paint_DrawPoint(60, | + | |
| - | + | ||
| - | Paint_DrawLine(10, | + | |
| - | Paint_DrawLine(30, | + | |
| - | Paint_DrawLine(50, | + | |
| - | Paint_DrawLine(70, | + | |
| - | + | ||
| - | Paint_DrawCircle(30, | + | |
| - | Paint_DrawRectangle(15, | + | |
| - | Paint_DrawCircle(80, | + | |
| - | Paint_DrawRectangle(65, | + | |
| - | Driver_Delay_ms(2000); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | Serial.print(" | + | |
| - | for(UBYTE i=0; i<16; i++){ | + | |
| - | Paint_DrawRectangle(0, | + | |
| - | } | + | |
| - | Driver_Delay_ms(2000); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | Serial.print(" | + | |
| - | Paint_DrawString_EN(10, | + | |
| - | Paint_DrawNum(10, | + | |
| - | Driver_Delay_ms(2000); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | Serial.print(" | + | |
| - | OLED_1in5_rgb_Display_Part(gImage_1in5_rgb, | + | |
| - | Driver_Delay_ms(2000); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | Serial.print(" | + | |
| - | char myChar = ' | + | |
| - | Paint_DrawChar(10, | + | |
| - | Paint_DrawString_EN(10, | + | |
| - | Paint_DrawNum(10, | + | |
| - | Paint_DrawNum(10, | + | |
| - | + | ||
| - | Driver_Delay_ms(2000); | + | |
| - | OLED_1in5_rgb_Clear(); | + | |
| - | + | ||
| - | } | + | |
| } | } | ||
| - | |||
| void loop() { | void loop() { | ||
| + | strip.clear(); | ||
| + | strip.setPixelColor(1, | ||
| + | strip.show(); | ||
| + | delay(1000); | ||
| + | strip.clear(); | ||
| + | strip.setPixelColor(6, | ||
| + | strip.show(); | ||
| + | delay(1500); | ||
| } | } | ||
| </ | </ | ||