Video link of station B’s colorful lights: https://www.bilibili.com/video/BV1HB4y1T75X/
Thanks to Tuya Smart for the event.
The world is big, let’s doodle together.
Use USB_TTL to connect to the CBU module, baud rate: 9600
(Result: The test distribution network is normal)
Figure 1 : Tuya serial port assistant
Reference tutorial: https://blog.csdn.net/y511374875/article/details/79086301
Change part:
SoftwareSerial mySerial(9, 10); // RX, TX
TuyaWifi my_device(&mySerial); // Use soft serial port
mySerial.begin(9600); // Software serial port initialization
The rest of the code is consistent with the hardware serial port
#define DPID_SWITCH_LED 20 // Switch ( can be issued and reported )
#define DPID_WORK_MODE 21 // Mode ( can be issued and reported )
#define DPID_MUSIC_DATA 27 // Music light ( only distributed )
#define DPID_DREAMLIGHT_SCENE_MODE 51 // Colorful scene ( can be distributed and reported )
#define DPID_LIGHTPIXEL_NUMBER_SET 53 // Point / length setting ( can be issued and reported )
unsigned char dp_array[][2] =
{
{DPID_SWITCH_LED, DP_TYPE_BOOL},
{DPID_WORK_MODE, DP_TYPE_ENUM},
{DPID_MUSIC_DATA, DP_TYPE_STRING},
{DPID_DREAMLIGHT_SCENE_MODE, DP_TYPE_RAW},
{DPID_LIGHTPIXEL_NUMBER_SET, DP_TYPE_VALUE},
};
Change: my_device.set_dp_cmd_total(dp_array, 5); //incoming all DPs and their types array, DP numbers
Library usage tutorial: http://www.taichi-maker.com/homepage/reference-index/arduino-library-index/fastled-library/#intro
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet