初始化blinker错误
求助,我想做个w2812的RGB灯带的,结果一直报错,有没有大佬给看看是哪里的问题啊。十分感谢!#define BLINKER_PRINT Serial
#define BLINKER_MIOT_LIGHT
#define BLINKER_WIFI
#include <Blinker.h>
#include <Adafruit_NeoPixel.h>
char auth[] = "key已更改";/****秘钥****/
#define PIN 15//DIN PIN (GPIO15, D8)
#define NUMPIXELS 30// Number of you led
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// 新建组件对象
BlinkerRGB RGB1("RGB");
int LED_R=0,LED_G=0,LED_B=0,LED_Bright=180;// RGB和亮度
bool WIFI_Status = true;
void smartConfig()//配网函数
{
WiFi.mode(WIFI_STA);
Serial.println("\r\nWait for Smartconfig...");
WiFi.beginSmartConfig();//等待手机端发出的用户名与密码
while (1)
{
Serial.print(".");
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
if (WiFi.smartConfigDone())//退出等待
{
Serial.println("SmartConfig Success");
Serial.printf("SSID:%s\r\n", WiFi.SSID().c_str());
Serial.printf("PSW:%s\r\n", WiFi.psk().c_str());
break;
}
}
}
void WIFI_Set()//
{
//Serial.println("\r\n正在连接");
int count = 0;
while(WiFi.status()!=WL_CONNECTED)
{
if(WIFI_Status)
{
Serial.print(".");
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
count++;
if(count>=5)//5s
{
WIFI_Status = false;
Serial.println("WiFi连接失败,请用手机进行配网");
}
}
else
{
smartConfig();//微信智能配网
}
}
/* Serial.println("连接成功");
Serial.print("IP:");
Serial.println(WiFi.localIP());*/
}
void SET_RGB(int R,int G,int B,int bright)
{
for (uint16_t i = 0; i < NUMPIXELS; i++) //把灯条变色
{
pixels.setPixelColor(i,R,G,B);
}
pixels.setBrightness(bright);//亮度
pixels.show(); //送出显示
}
//APP RGB颜色设置回调
void rgb1_callback(uint8_t r_value, uint8_t g_value,
uint8_t b_value, uint8_t bright_value)
{
//digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
BLINKER_LOG("R value: ", r_value);
BLINKER_LOG("G value: ", g_value);
BLINKER_LOG("B value: ", b_value);
BLINKER_LOG("Rrightness value: ", bright_value);
LED_Bright = bright_value;
SET_RGB(r_value,g_value,b_value,LED_Bright);
}
void setup() {
// 初始化串口
Serial.begin(115200);
pixels.begin();//WS2812初始化
pixels.show();
pinMode(LED_BUILTIN, OUTPUT);
#if defined(BLINKER_PRINT)
BLINKER_DEBUG.stream(BLINKER_PRINT);
#endif
WIFI_Set();
// 初始化blinker
Blinker.begin(auth, WiFi.SSID().c_str(), WiFi.psk().c_str());
RGB1.attach(rgb1_callback);//注册调节颜色的回调函数
}
void loop() {
Blinker.run();
} // 初始化blinker
Blinker.begin(auth, WiFi.SSID().c_str(), WiFi.psk().c_str());
这一行报错,不知道是咋回事。
Arduino:1.8.13 (Windows 10), 开发板:"Arduino Yún" E:\Users\Dell\Desktop\My_ESP8266\blinker控制WS2812\blinkerWS2812\blinkerWS2812.ino: In function 'void smartConfig()':blinkerWS2812:20:3: error: 'WiFi' was not declared in this scopeblinkerWS2812:20:13: error: 'WIFI_STA' was not declared in this scopeE:\Users\Dell\Desktop\My_ESP8266\blinker控制WS2812\blinkerWS2812\blinkerWS2812.ino:20:13: note: suggested alternative: 'WIFI_Set'blinkerWS2812:33:14: error: 'class Serial_' has no member named 'printf'; did you mean 'print'?blinkerWS2812:34:14: error: 'class Serial_' has no member named 'printf'; did you mean 'print'?E:\Users\Dell\Desktop\My_ESP8266\blinker控制WS2812\blinkerWS2812\blinkerWS2812.ino: In function 'void WIFI_Set()':blinkerWS2812:43:11: error: 'WiFi' was not declared in this scopeblinkerWS2812:43:26: error: 'WL_CONNECTED' was not declared in this scopeE:\Users\Dell\Desktop\My_ESP8266\blinker控制WS2812\blinkerWS2812\blinkerWS2812.ino:43:26: note: suggested alternative: 'DISCONNECTED'E:\Users\Dell\Desktop\My_ESP8266\blinker控制WS2812\blinkerWS2812\blinkerWS2812.ino: In function 'void setup()':blinkerWS2812:105:25: error: 'WiFi' was not declared in this scopeexit status 1'WiFi' was not declared in this scope 在文件 -> 首选项开启 “编译过程中显示详细输出”选项 这份报告会包含更多信息。 这是错误信息 没找到库 你用的是arduino yun?烧写程序前,先选择开发板和对应的端口。建议先阅读社区教程,学习arduino基础知识。
页:
[1]