2664| 0
|
[ESP8266/ESP32] esp32s报 为开发板 Node32s 编译时出错。 |
源码 #include <FastLED.h> #define led_type WS2812 //灯珠类型 #define led_pin 14 //控制引脚 #define color GRB //RGB中红绿蓝led灯的顺序 #define num 30 //灯珠数量 #include <BluetoothSerial.h> #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run 'make menuconfig' to and enable it #endif //判断蓝牙是否启用,没有请运行并启用它 BluetoothSerial lanya;//创建对象 int bright = 128;//灯珠的亮度,在0-255之间设置 CRGB leds[num];//建立光带对象leds int speeds = 25;//灯珠移动速度 uint8_t startIndex;//该变量从0-255,到255后有变为0 void setup() { LEDS.addLeds<led_type,led_pin,color>(leds,num);//初始化灯带 FastLED.setBrightness(bright);//设置灯带亮度 Serial.begin(9600); lanya.begin("esp32BT");//初始化蓝牙并命名 } void loop() { if(lanya.available()){//如果蓝牙接收到数据 byte x = lanya.read();//蓝牙读取的数据 /*if(x == 1){ digitalWrite(led,HIGH); }else if(x == 2){ digitalWrite(led,LOW); }*/ } delay(20); } void kz2812(String color){ startIndex++;//改变起始颜色序号,产生流动效果 fill_palette(leds, num, startIndex, 8, color, 255, LINEARBLEND); // (led名称,灯珠数量,起始颜色序号,灯珠间的颜色差,palette色板名, 亮度,过渡情况(LINEARBLEND或者NOBLEDD)); FastLED.show(); delay(speeds); } /* CloudColors_p:云彩 LavaColors_p:岩浆 OceanColors_p:海洋 ForesColors_p:森林 RainbowColors_p:彩虹 RainbowStripeColors_p:彩虹 PartyColors_p:聚会 HeatColors_p:热情 */ 下面是报错信息 Arduino:1.8.20 Hourly Build 2022/04/25 09:33 (Windows 10), 开发板:"Node32s, Default, 80MHz, 921600, None" In file included from D:\ESP8266\libraries\FastLED\src/FastLED.h:67:0, from D:\ESP8266\ESP32学习代码\esp32蓝牙控制ws2812灯带\sketch_sep19e\sketch_sep19e.ino:1: D:\ESP8266\libraries\FastLED\src/fastspi.h:145:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output # pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output" ^ In file included from D:\ESP8266\libraries\FastLED\src/FastLED.h:60:0, from D:\ESP8266\ESP32学习代码\esp32蓝牙控制ws2812灯带\sketch_sep19e\sketch_sep19e.ino:1: D:\ESP8266\libraries\FastLED\src/colorutils.h: In instantiation of 'void fill_palette(CRGB*, uint16_t, uint8_t, uint8_t, const PALETTE&, uint8_t, TBlendType) [with PALETTE = String; uint16_t = short unsigned int; uint8_t = unsigned char]': D:\ESP8266\ESP32学习代码\esp32蓝牙控制ws2812灯带\sketch_sep19e\sketch_sep19e.ino:47:86: required from here D:\ESP8266\libraries\FastLED\src/colorutils.h:1561:32: error: no matching function for call to 'ColorFromPalette(const String&, uint8_t&, uint8_t&, TBlendType&)' L[i] = ColorFromPalette( pal, colorIndex, brightness, blendType); ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1513:6: note: candidate: CRGB ColorFromPalette(const CRGBPalette16&, uint8_t, uint8_t, TBlendType) CRGB ColorFromPalette( const CRGBPalette16& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1513:6: note: no known conversion for argument 1 from 'const String' to 'const CRGBPalette16&' D:\ESP8266\libraries\FastLED\src/colorutils.h:1518:6: note: candidate: CRGB ColorFromPalette(const uint32_t (&)[16], uint8_t, uint8_t, TBlendType) CRGB ColorFromPalette( const TProgmemRGBPalette16& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1518:6: note: no known conversion for argument 1 from 'const String' to 'const uint32_t (&)[16] {aka const unsigned int (&)[16]}' D:\ESP8266\libraries\FastLED\src/colorutils.h:1523:6: note: candidate: CRGB ColorFromPalette(const CRGBPalette256&, uint8_t, uint8_t, TBlendType) CRGB ColorFromPalette( const CRGBPalette256& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1523:6: note: no known conversion for argument 1 from 'const String' to 'const CRGBPalette256&' D:\ESP8266\libraries\FastLED\src/colorutils.h:1528:6: note: candidate: CHSV ColorFromPalette(const CHSVPalette16&, uint8_t, uint8_t, TBlendType) CHSV ColorFromPalette( const CHSVPalette16& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1528:6: note: no known conversion for argument 1 from 'const String' to 'const CHSVPalette16&' D:\ESP8266\libraries\FastLED\src/colorutils.h:1533:6: note: candidate: CHSV ColorFromPalette(const CHSVPalette256&, uint8_t, uint8_t, TBlendType) CHSV ColorFromPalette( const CHSVPalette256& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1533:6: note: no known conversion for argument 1 from 'const String' to 'const CHSVPalette256&' D:\ESP8266\libraries\FastLED\src/colorutils.h:1538:6: note: candidate: CRGB ColorFromPalette(const CRGBPalette32&, uint8_t, uint8_t, TBlendType) CRGB ColorFromPalette( const CRGBPalette32& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1538:6: note: no known conversion for argument 1 from 'const String' to 'const CRGBPalette32&' D:\ESP8266\libraries\FastLED\src/colorutils.h:1543:6: note: candidate: CRGB ColorFromPalette(const uint32_t (&)[32], uint8_t, uint8_t, TBlendType) CRGB ColorFromPalette( const TProgmemRGBPalette32& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1543:6: note: no known conversion for argument 1 from 'const String' to 'const uint32_t (&)[32] {aka const unsigned int (&)[32]}' D:\ESP8266\libraries\FastLED\src/colorutils.h:1548:6: note: candidate: CHSV ColorFromPalette(const CHSVPalette32&, uint8_t, uint8_t, TBlendType) CHSV ColorFromPalette( const CHSVPalette32& pal, ^ D:\ESP8266\libraries\FastLED\src/colorutils.h:1548:6: note: no known conversion for argument 1 from 'const String' to 'const CHSVPalette32&' exit status 1 为开发板 Node32s 编译时出错。 在文件 -> 首选项开启 “编译过程中显示详细输出”选项 这份报告会包含更多信息。 |
© 2013-2025 Comsenz Inc. Powered by Discuz! X3.4 Licensed