【花雕动手做】实验十一:通过语音控制1.77寸彩屏显示不同图形
实验开源代码
- #define ASC2_12
- #define ST7735_CS_PIN 9
- #define ST7735_CS_GPIO_PIN gpio_pin_1
- #define ST7735_DC_PIN 1
- #define ST7735_DC_GPIO_PIN gpio_pin_1
- #define ST7735_RST_PIN 25
- #define ST7735_RST_GPIO_PIN gpio_pin_1
- #define ST7735_SCK_PIN 3
- #define ST7735_SCK_GPIO_PIN gpio_pin_3
- #define ST7735_MOSI_PIN 2
- #define ST7735_MOSI_GPIO_PIN gpio_pin_2
- #define ST7735S_RGB_GBR_ORDER 0
-
- #include "asr.h"
- extern "C"{ void * __dso_handle = 0 ;}
- #include "setup.h"
- #include "myLib/asr_event.h"
- #include "myLib/asr_st7735.h"
-
- uint32_t snid;
- int8_t volue = 5;
- void hardware_init();
-
- //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
- //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
- //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
- SPITFT spi_tft(128, 160);
- void ASR_CODE()
- {
- //{ID:500,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在呢"}
- if(snid == 500){
- digital_write((21),0);
- }
- //{ID:501,keyword:"命令词",ASR:"不错啊",ASRTO:"谢谢,更多精彩在后面"}
- if(snid == 501){
-
- }
- //{ID:502,keyword:"命令词",ASR:"画个红点",ASRTO:"有了"}
- if(snid == 502){
- spi_tft.draw_point(64,80,(0xF800));
- }
- //{ID:503,keyword:"命令词",ASR:"蓝色背景",ASRTO:"可以了"}
- if(snid == 503){
- spi_tft.clear((0x001F));
- }
- //{ID:504,keyword:"命令词",ASR:"打开屏幕",ASRTO:"好的"}
- if(snid == 504){
- digital_write((21),1);
- spi_tft.clear((0xFFFF));
- }
- //{ID:505,keyword:"命令词",ASR:"空心圆",ASRTO:"当中没有"}
- if(snid == 505){
- spi_tft.draw_circle(50,50,50,(0xF800));
- }
- //{ID:506,keyword:"命令词",ASR:"三角形",ASRTO:"绿色的"}
- if(snid == 506){
- spi_tft.fill_triangle(10,123,55,10,110,155,(0x07E0));
- }
- //{ID:507,keyword:"命令词",ASR:"实心圆",ASRTO:"填满了"}
- if(snid == 507){
- spi_tft.fill_circle(50,50,50,(0xF800));
- }
- //{ID:508,keyword:"命令词",ASR:"画条直线",ASRTO:"红色的"}
- if(snid == 508){
- spi_tft.draw_line(0,80,128,80,(0xF800));
- }
- //{ID:509,keyword:"命令词",ASR:"画条竖线",ASRTO:"绿色的"}
- if(snid == 509){
- spi_tft.draw_line(64,0,64,160,(0x07E0));
- }
- //{ID:510,keyword:"命令词",ASR:"空心矩形",ASRTO:"蓝色的"}
- if(snid == 510){
- spi_tft.draw_rectangle(13,12,99,130,(0x001F));
- }
- //{ID:511,keyword:"命令词",ASR:"两条蓝线",ASRTO:"交叉了"}
- if(snid == 511){
- spi_tft.draw_line(0,0,128,160,(0x001F));
- spi_tft.draw_line(0,160,128,0,(0x001F));
- }
- //{ID:512,keyword:"命令词",ASR:"实心矩形",ASRTO:"还是蓝色"}
- if(snid == 512){
- spi_tft.fill_rectangle(13,12,99,130,(0x001F));
- }
- }
-
- void hardware_init(){
- spi_tft.init();
- digital_write((21),0);
- spi_tft.set_direction(2);
- vTaskDelete(NULL);
- }
-
- void setup()
- {
- //{speak:小美-娇美女声,vol:20,speed:10,platform:haohaodada}
- //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
- //{playid:10002,voice:我要退下了,用智能管家唤醒我}
- xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
- }
复制代码
天问Block(标准模式)训练模型与编译烧录
实验记录视频
https://www.bilibili.com/video/BV1tb4y1g7G3/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987
|