修复 NodeMCU 灯效。
This commit is contained in:
parent
507daace85
commit
1b6174d696
@ -62,23 +62,22 @@ void setup() {
|
|||||||
// SerialDevice.begin(119200);//high_baudrate=true
|
// SerialDevice.begin(119200);//high_baudrate=true
|
||||||
SerialDevice.setTimeout(0);
|
SerialDevice.setTimeout(0);
|
||||||
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
|
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
|
||||||
|
FastLED.setBrightness(50);
|
||||||
nfc.begin();
|
nfc.begin();
|
||||||
if (!nfc.getFirmwareVersion()) {
|
while (!nfc.getFirmwareVersion()) {
|
||||||
while (1) {
|
|
||||||
fill_solid(leds, NUM_LEDS, 0xFF0000);
|
fill_solid(leds, NUM_LEDS, 0xFF0000);
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
delay(500);
|
delay(500);
|
||||||
fill_solid(leds, NUM_LEDS, 0x000000);
|
fill_solid(leds, NUM_LEDS, 0x000000);
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nfc.setPassiveActivationRetries(0x10);//设定等待次数
|
nfc.setPassiveActivationRetries(0x10);//设定等待次数
|
||||||
nfc.SAMConfig();
|
nfc.SAMConfig();
|
||||||
memset(&req, 0, sizeof(req.bytes));
|
memset(&req, 0, sizeof(req.bytes));
|
||||||
memset(&res, 0, sizeof(res.bytes));
|
memset(&res, 0, sizeof(res.bytes));
|
||||||
fill_solid(leds, NUM_LEDS, 0x0000FF);
|
fill_solid(leds, NUM_LEDS, 0x0000FF);
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
9
cmd.h
9
cmd.h
@ -1,7 +1,6 @@
|
|||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
#define NUM_LEDS 6
|
#define NUM_LEDS 6
|
||||||
#define DATA_PIN D5
|
#define DATA_PIN 14
|
||||||
#define BRI 50
|
|
||||||
CRGB leds[NUM_LEDS];
|
CRGB leds[NUM_LEDS];
|
||||||
|
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
@ -139,7 +138,7 @@ static void sg_nfc_cmd_reset() {//重置读卡器
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fill_solid(leds, NUM_LEDS, 0xFFFF00);
|
fill_solid(leds, NUM_LEDS, 0xFFFF00);
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sg_nfc_cmd_get_fw_version() {
|
static void sg_nfc_cmd_get_fw_version() {
|
||||||
@ -167,7 +166,7 @@ static void sg_led_cmd_reset() {
|
|||||||
sg_res_init(1);
|
sg_res_init(1);
|
||||||
res.reset_payload = 0;
|
res.reset_payload = 0;
|
||||||
fill_solid(leds, NUM_LEDS, 0x000000);
|
fill_solid(leds, NUM_LEDS, 0x000000);
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sg_led_cmd_get_info() {
|
static void sg_led_cmd_get_info() {
|
||||||
@ -181,7 +180,7 @@ static void sg_led_cmd_set_color() {
|
|||||||
uint8_t g = req.color_payload[1];
|
uint8_t g = req.color_payload[1];
|
||||||
uint8_t b = req.color_payload[2];
|
uint8_t b = req.color_payload[2];
|
||||||
fill_solid(leds, NUM_LEDS, CRGB(r, g, b));
|
fill_solid(leds, NUM_LEDS, CRGB(r, g, b));
|
||||||
FastLED[0].show(leds, NUM_LEDS, BRI);
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sg_nfc_cmd_radio_on() {
|
static void sg_nfc_cmd_radio_on() {
|
||||||
|
Loading…
Reference in New Issue
Block a user