1477浏览
查看: 1477|回复: 2

[项目] 【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色

[复制链接]
ASRPRO-Plus开发板

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图1

板子基本介绍

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图2

本例实验的RGB LED模块:

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图3

本例实验的RGB LED模块的电原理图

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图4

实验之四:通过语音控制,WS2812B的点亮和变色
实验开源代码


  1. #include "asr.h"
  2. extern "C"{ void * __dso_handle = 0 ;}
  3. #include "setup.h"
  4. #include "myLib/asr_event.h"
  5. #include "myLib/asr_ws2812.h"
  6. uint32_t snid;
  7. void hardware_init();
  8. //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
  9. //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
  10. //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
  11. WS2812 ASR_WS2812_27(27);
  12. void ASR_CODE()
  13. {
  14.   //{ID:500,keyword:"命令词",ASR:"打开灯光",ASRTO:"灯光已打开"}
  15.   if(snid == 500){
  16.     ASR_WS2812_27.pixel_set_all_color(240,240,240);
  17.     ASR_WS2812_27.pixel_show();
  18.   }
  19.   //{ID:501,keyword:"命令词",ASR:"关闭灯光",ASRTO:"灯光已关闭"}
  20.   if(snid == 501){
  21.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  22.     ASR_WS2812_27.pixel_show();
  23.     digital_write(4,1);
  24.   }
  25.   //{ID:502,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在呢"}
  26.   if(snid == 502){
  27.     digital_write(4,0);
  28.   }
  29.   //{ID:503,keyword:"命令词",ASR:"打开红灯",ASRTO:"红灯已打开"}
  30.   if(snid == 503){
  31.     ASR_WS2812_27.setBrightness(150);
  32.     ASR_WS2812_27.pixel_set_all_color(255,0,0);
  33.     ASR_WS2812_27.pixel_show();
  34.   }
  35.   //{ID:504,keyword:"命令词",ASR:"打开蓝灯",ASRTO:"蓝灯已打开"}
  36.   if(snid == 504){
  37.     ASR_WS2812_27.setBrightness(250);
  38.     ASR_WS2812_27.pixel_set_all_color(0,0,255);
  39.     ASR_WS2812_27.pixel_show();
  40.   }
  41.   //{ID:505,keyword:"命令词",ASR:"关闭红灯",ASRTO:"红灯已关闭"}
  42.   if(snid == 505){
  43.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  44.     ASR_WS2812_27.pixel_show();
  45.   }
  46.   //{ID:506,keyword:"命令词",ASR:"关闭蓝灯",ASRTO:"蓝灯已关闭"}
  47.   if(snid == 506){
  48.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  49.     ASR_WS2812_27.pixel_show();
  50.   }
  51.   //{ID:507,keyword:"命令词",ASR:"打开绿灯",ASRTO:"绿灯已打开"}
  52.   if(snid == 507){
  53.     ASR_WS2812_27.setBrightness(200);
  54.     ASR_WS2812_27.pixel_set_all_color(0,255,0);
  55.     ASR_WS2812_27.pixel_show();
  56.   }
  57.   //{ID:508,keyword:"命令词",ASR:"关闭绿灯",ASRTO:"绿灯已关闭"}
  58.   if(snid == 508){
  59.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  60.     ASR_WS2812_27.pixel_show();
  61.   }
  62. }
  63. void hardware_init(){
  64.   ASR_WS2812_27.pixel_init(3);
  65.   vTaskDelete(NULL);
  66. }
  67. void setup()
  68. {
  69.   //{speak:橙子-甜美客服,vol:20,speed:10,platform:haohaodada}
  70.   //{playid:10001,voice:欢迎使用AI智能语音助手,用智能管家唤醒我}
  71.   //{playid:10002,voice:我要退下了,用智能管家唤醒我}
  72.   digital_write((4),1);
  73.   xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
  74. }
复制代码


天问Block(标准模式)训练模型与烧录

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图5

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图6

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图7

实验视频:

https://www.bilibili.com/video/BV1XN4y16765/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987





驴友花雕  中级技神
 楼主|

发表于 2023-11-2 20:10:24

实验之五:语音控制WS2812B,实现彩虹呼吸灯与流光溢彩的效果
实验开源代码

  1. #include "asr.h"
  2. extern "C"{ void * __dso_handle = 0 ;}
  3. #include "setup.h"
  4. #include "myLib/asr_event.h"
  5. #include "myLib/asr_ws2812.h"
  6. uint32_t snid;
  7. void hardware_init();
  8. //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
  9. //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
  10. //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
  11. WS2812 ASR_WS2812_27(27);
  12. void ASR_CODE()
  13. {
  14.   //{ID:500,keyword:"命令词",ASR:"打开灯光",ASRTO:"灯光已打开"}
  15.   if(snid == 500){
  16.     ASR_WS2812_27.pixel_set_all_color(240,240,240);
  17.     ASR_WS2812_27.pixel_show();
  18.   }
  19.   //{ID:501,keyword:"命令词",ASR:"关闭灯光",ASRTO:"灯光已关闭"}
  20.   if(snid == 501){
  21.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  22.     ASR_WS2812_27.pixel_show();
  23.     digital_write(4,1);
  24.   }
  25.   //{ID:502,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在呢"}
  26.   if(snid == 502){
  27.     digital_write(4,0);
  28.   }
  29.   //{ID:503,keyword:"命令词",ASR:"打开红灯",ASRTO:"红灯已打开"}
  30.   if(snid == 503){
  31.     ASR_WS2812_27.setBrightness(150);
  32.     ASR_WS2812_27.pixel_set_all_color(255,0,0);
  33.     ASR_WS2812_27.pixel_show();
  34.   }
  35.   //{ID:504,keyword:"命令词",ASR:"打开蓝灯",ASRTO:"蓝灯已打开"}
  36.   if(snid == 504){
  37.     ASR_WS2812_27.setBrightness(250);
  38.     ASR_WS2812_27.pixel_set_all_color(0,0,255);
  39.     ASR_WS2812_27.pixel_show();
  40.   }
  41.   //{ID:505,keyword:"命令词",ASR:"关闭红灯",ASRTO:"红灯已关闭"}
  42.   if(snid == 505){
  43.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  44.     ASR_WS2812_27.pixel_show();
  45.   }
  46.   //{ID:506,keyword:"命令词",ASR:"关闭蓝灯",ASRTO:"蓝灯已关闭"}
  47.   if(snid == 506){
  48.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  49.     ASR_WS2812_27.pixel_show();
  50.   }
  51.   //{ID:507,keyword:"命令词",ASR:"打开绿灯",ASRTO:"绿灯已打开"}
  52.   if(snid == 507){
  53.     ASR_WS2812_27.setBrightness(200);
  54.     ASR_WS2812_27.pixel_set_all_color(0,255,0);
  55.     ASR_WS2812_27.pixel_show();
  56.   }
  57.   //{ID:508,keyword:"命令词",ASR:"彩虹呼吸灯",ASRTO:"已执行"}
  58.   if(snid == 508){
  59.     ASR_WS2812_27.rainbowCycle(5);
  60.     ASR_WS2812_27.pixel_show();
  61.   }
  62.   //{ID:509,keyword:"命令词",ASR:"关闭绿灯",ASRTO:"绿灯已关闭"}
  63.   if(snid == 509){
  64.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  65.     ASR_WS2812_27.pixel_show();
  66.   }
  67.   //{ID:510,keyword:"命令词",ASR:"流光溢彩灯",ASRTO:"已执行"}
  68.   if(snid == 510){
  69.     ASR_WS2812_27.rainbow(25);
  70.     ASR_WS2812_27.pixel_show();
  71.   }
  72.   //{ID:511,keyword:"命令词",ASR:"不错哦",ASRTO:"谢谢你的鼓励!"}
  73.   if(snid == 511){
  74.   }
  75. }
  76. void hardware_init(){
  77.   ASR_WS2812_27.pixel_init(3);
  78.   vTaskDelete(NULL);
  79. }
  80. void setup()
  81. {
  82.   //{speak:阿栋-浑厚男声,vol:20,speed:10,platform:haohaodada}
  83.   //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
  84.   //{playid:10002,voice:我要退下了,用智能管家唤醒我}
  85.   digital_write((4),1);
  86.   xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
  87. }
复制代码


天问Block(标准模式)训练模型与烧录

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图1
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图2
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图3
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图4

实验视频


https://www.bilibili.com/video/BV1gj411Y7rk/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987






回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2023-11-3 15:39:24

实验之六:语音控制WS2812B,实现单个灯珠的颜色变化
实验开源代码

  1. #include "asr.h"
  2. extern "C"{ void * __dso_handle = 0 ;}
  3. #include "setup.h"
  4. #include "myLib/asr_event.h"
  5. #include "myLib/asr_ws2812.h"
  6. uint32_t snid;
  7. void hardware_init();
  8. //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
  9. //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
  10. //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
  11. WS2812 ASR_WS2812_27(27);
  12. void ASR_CODE()
  13. {
  14.   //{ID:500,keyword:"命令词",ASR:"打开灯光",ASRTO:"灯光已打开"}
  15.   if(snid == 500){
  16.     ASR_WS2812_27.pixel_set_all_color(200,200,200);
  17.     ASR_WS2812_27.pixel_show();
  18.   }
  19.   //{ID:501,keyword:"命令词",ASR:"关闭灯光",ASRTO:"灯光已关闭"}
  20.   if(snid == 501){
  21.     ASR_WS2812_27.pixel_set_all_color(0,0,0);
  22.     ASR_WS2812_27.pixel_show();
  23.     digital_write(4,1);
  24.   }
  25.   //{ID:502,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在呢"}
  26.   if(snid == 502){
  27.     digital_write(4,0);
  28.   }
  29.   //{ID:503,keyword:"命令词",ASR:"不错呀",ASRTO:"谢谢夸奖"}
  30.   if(snid == 503){
  31.   }
  32.   //{ID:504,keyword:"命令词",ASR:"彩虹呼吸",ASRTO:"已执行"}
  33.   if(snid == 504){
  34.     ASR_WS2812_27.rainbowCycle(5);
  35.     ASR_WS2812_27.pixel_show();
  36.   }
  37.   //{ID:505,keyword:"命令词",ASR:"还有什么变化",ASRTO:"三个灯不同颜色"}
  38.   if(snid == 505){
  39.   }
  40.   //{ID:506,keyword:"命令词",ASR:"那我试试",ASRTO:"请开始你的表演"}
  41.   if(snid == 506){
  42.   }
  43.   //{ID:507,keyword:"命令词",ASR:"红蓝绿",ASRTO:"红蓝绿灯已打开"}
  44.   if(snid == 507){
  45.     ASR_WS2812_27.setBrightness(200);
  46.     ASR_WS2812_27.pixel_set_color(0,255,0,0);
  47.     ASR_WS2812_27.setBrightness(250);
  48.     ASR_WS2812_27.pixel_set_color(1,0,0,255);
  49.     ASR_WS2812_27.setBrightness(200);
  50.     ASR_WS2812_27.pixel_set_color(2,0,255,0);
  51.     ASR_WS2812_27.pixel_show();
  52.   }
  53.   //{ID:508,keyword:"命令词",ASR:"红灯",ASRTO:"一个灯"}
  54.   if(snid == 508){
  55.     ASR_WS2812_27.setBrightness(200);
  56.     ASR_WS2812_27.pixel_set_color(0,255,0,0);
  57.     ASR_WS2812_27.setBrightness(0);
  58.     ASR_WS2812_27.pixel_set_color(1,0,136,255);
  59.     ASR_WS2812_27.setBrightness(0);
  60.     ASR_WS2812_27.pixel_set_color(2,136,0,255);
  61.     ASR_WS2812_27.pixel_show();
  62.   }
  63.   //{ID:509,keyword:"命令词",ASR:"蓝红绿",ASRTO:"蓝红绿灯已打开"}
  64.   if(snid == 509){
  65.     ASR_WS2812_27.setBrightness(250);
  66.     ASR_WS2812_27.pixel_set_color(0,0,0,255);
  67.     ASR_WS2812_27.setBrightness(200);
  68.     ASR_WS2812_27.pixel_set_color(1,255,0,0);
  69.     ASR_WS2812_27.setBrightness(200);
  70.     ASR_WS2812_27.pixel_set_color(2,0,255,0);
  71.     ASR_WS2812_27.pixel_show();
  72.   }
  73.   //{ID:510,keyword:"命令词",ASR:"蓝灯",ASRTO:"二个灯"}
  74.   if(snid == 510){
  75.     ASR_WS2812_27.setBrightness(200);
  76.     ASR_WS2812_27.pixel_set_color(0,0,0,255);
  77.     ASR_WS2812_27.setBrightness(200);
  78.     ASR_WS2812_27.pixel_set_color(1,0,0,255);
  79.     ASR_WS2812_27.setBrightness(0);
  80.     ASR_WS2812_27.pixel_set_color(2,255,255,0);
  81.     ASR_WS2812_27.pixel_show();
  82.   }
  83.   //{ID:511,keyword:"命令词",ASR:"绿蓝红",ASRTO:"绿蓝红灯已打开"}
  84.   if(snid == 511){
  85.     ASR_WS2812_27.setBrightness(200);
  86.     ASR_WS2812_27.pixel_set_color(0,0,255,0);
  87.     ASR_WS2812_27.setBrightness(250);
  88.     ASR_WS2812_27.pixel_set_color(1,0,0,255);
  89.     ASR_WS2812_27.setBrightness(200);
  90.     ASR_WS2812_27.pixel_set_color(2,255,0,0);
  91.     ASR_WS2812_27.pixel_show();
  92.   }
  93.   //{ID:512,keyword:"命令词",ASR:"绿灯",ASRTO:"三个灯"}
  94.   if(snid == 512){
  95.     ASR_WS2812_27.setBrightness(200);
  96.     ASR_WS2812_27.pixel_set_color(0,0,255,0);
  97.     ASR_WS2812_27.setBrightness(200);
  98.     ASR_WS2812_27.pixel_set_color(1,0,255,0);
  99.     ASR_WS2812_27.setBrightness(200);
  100.     ASR_WS2812_27.pixel_set_color(2,0,255,0);
  101.     ASR_WS2812_27.pixel_show();
  102.   }
  103. }
  104. void hardware_init(){
  105.   ASR_WS2812_27.pixel_init(3);
  106.   vTaskDelete(NULL);
  107. }
  108. void setup()
  109. {
  110.   //{speak:橙子-甜美客服,vol:20,speed:10,platform:haohaodada}
  111.   //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
  112.   //{playid:10002,voice:我要退下了,用智能管家唤醒我}
  113.   digital_write((4),1);
  114.   xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
  115. }
复制代码

天问Block(标准模式)训练模型与编译烧录

【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图1
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图2
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图3
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图4
【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图5

实验记录视频

https://www.bilibili.com/video/BV1Dj411a74d/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987



【花雕动手做】ASRPRO-Plus语音识别(05)---WS2812B的点亮和变色图6



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail