mian程序

main

#include 
#include "config.h"

#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include 

char auth[]  = "9bd88da46b95";//APP密钥//

int R_VAL=202;
int G_VAL=215;
int B_VAL=0;
#define R_PIN 4             //定义LED2灯引脚
#define G_PIN 5             //定义LED1灯引脚
#define B_PIN 14             //定义LED5灯引脚
int buttonPin = 0;          // 按键的管脚定义
// 新建组件对象
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");
BlinkerRGB    RGB1("col-9bf");
int counter = 0;

// 按下按键即会执行该函数
void button1_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
     Button1.print("off");
    if(state=="on")
   { 
    R_VAL= 255;//越大越亮,三种灯的亮暗程度不同显示不同的颜色,全亮//
    G_VAL= 255;
    B_VAL= 255;  
   }
   else if(state=="off")
   {
    R_VAL= 0;//全灭//
    G_VAL= 0;
    B_VAL= 0;
    }
    analogWrite(R_PIN, 1023-R_VAL*4);//将255放大1023,再将1023变成0,1022变成1······//
    analogWrite(G_PIN, 1023-G_VAL*4);
    analogWrite(B_PIN, 1023-B_VAL*4);  
}

// 如果未绑定的组件被触发,则会执行其中内容
void dataRead(const String & data)
{
    BLINKER_LOG("Blinker readString: ", data);
    
    counter++;
    Number1.print(counter);
}
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);
    R_VAL= r_value;
    G_VAL= g_value;
    B_VAL= b_value;
    analogWrite(R_PIN, 1023-R_VAL*4);//将255放大1023,再将1023变成0,1022变成1······//
    analogWrite(G_PIN, 1023-G_VAL*4);
    analogWrite(B_PIN, 1023-B_VAL*4);
}

  
void setup() {
  
  Serial.begin(115200);
  Serial.println("star");//串口输出打印//
  String name_1=reader("name");
  String pwd_1=reader("pwd");
  char name_2[name_1.length()+1];
  char pwd_2[pwd_1.length()+1];
  
  for(int i=0;i

你可能感兴趣的:(mian程序)