当前位置: 首页 > news >正文

旅游网站建设的方向今日十大头条新闻

旅游网站建设的方向,今日十大头条新闻,蓬莱有做网站的吗,旅游信息网站开发背景大家好啊,我是情谊,今天我们来介绍一下我最近设计的stm32产品,我们在今年七月份的时候参加了光电设计大赛,我们小队使用的就是stm32的智能送餐小车,虽然止步于省赛,但是还是一次成长的经验吧,那…

大家好啊,我是情谊,今天我们来介绍一下我最近设计的stm32产品,我们在今年七月份的时候参加了光电设计大赛,我们小队使用的就是stm32的智能送餐小车,虽然止步于省赛,但是还是一次成长的经验吧,那么我也来分享一下我们小队这次的产品设计,希望里面的一些模块可以给你们一点的参考建议。

我先说说我的博客文章的设计吧,我准备的是以模块的方式展示代码,但是文章的最后我会附带我们小队设计的stm32小车的完整代码

接下来我再说说我的小车实现的功能:

1二维码识别,使用openmv扫描对应颜色的二维码后,oled屏幕上显示对应的菜品名称,并且小车识别追踪该颜色物体

2压力传感器感知物体重量,当压力传感器的重量超过一定值后小车才会运动,注意!这个功能和上面的二维码识别并不冲突,上面扫码后openmv只能识别到该颜色,但是小车却不能动,只有压力传感器有示数才会运动

3APP点单,我们小组是使用ESP8266wifi模块制作了一个APP来模拟点单

4温度传感器时刻感知环境温度,这个模块的功能其实就是在送餐途中进行保温使用的

5蜂鸣器播报,客户下单后蜂鸣器会进行鸣叫

6红外光管避障,我们小组并未在避障方面进行过多的功能,所以只有简单的避障功能:小车识别到前方有物体,然后停下来,等到前方没有物体后继续运动

以上就是我的产品的全部功能了

注意注意!!!

我文章末尾上传的代码只有功能1和功能2和功能6的代码,功能3我只能负责给你们说说怎么做,如果实在需要代码,请联系我,这部分代码不是免费的,功能4和功能5的代码不在我的电脑上,所以我就不进行讲解了。

器件端

首先声明一下

本次实验的芯片是基于stm32c8t6

本次实验使用的openmv型号为openmvH7

OpenMV开发环境搭建

OpenMV IDE是用于OpenMV Cam的集成开发环境,具有强大的文本编辑器,调试终端和带有直方图显示的帧缓冲区查看器。

官方下载链接:Download – OpenMV,截至本文写作时间,最新版本为v4.2.1。

本次实验接口为串口三

代码端 

openmv

import sensor, image, time
from pyb import UART
from pyb import LEDsensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)# 初始化LED灯
led_red = LED(1)
led_green = LED(2)
led_blue = LED(3)# 初始化UART
uart = UART(3, 9600)clock = time.clock()last_qr_color = Nonewhile True:clock.tick()img = sensor.snapshot()# 寻找二维码qr_codes = img.find_qrcodes()if qr_codes:# 获取第一个二维码的颜色信息qr_color = qr_codes[0].payload()last_qr_color = qr_colorblobs = Noneif qr_color == "green":# 绿色物体识别green_threshold = (0, 100, -12, 11, -108, 34)blobs = img.find_blobs([green_threshold], pixels_threshold=100, area_threshold=100, merge=True)led_green.on()led_red.off()led_blue.off()elif qr_color == "red":# 红色物体识别red_threshold = (0, 80, 30, 127, 30, 127)blobs = img.find_blobs([red_threshold], pixels_threshold=100, area_threshold=100, merge=True)led_green.off()led_red.on()led_blue.off()else:# 其他颜色处理blobs = Noneled_green.off()led_red.off()led_blue.off()else:# 如果没有检测到二维码,则继续识别上次记录的颜色qr_color = last_qr_colorblobs = Noneif qr_color == "green":# 绿色物体识别green_threshold = (30, 100, -64, -8, -32, 32)blobs = img.find_blobs([green_threshold], pixels_threshold=100, area_threshold=100, merge=True)led_green.on()led_red.off()led_blue.off()elif qr_color == "red":# 红色物体识别red_threshold = (0, 80, 30, 127, 30, 127)blobs = img.find_blobs([red_threshold], pixels_threshold=100, area_threshold=100, merge=True)led_green.off()led_red.on()led_blue.off()else:# 其他颜色处理blobs = Noneled_green.off()led_red.off()led_blue.off()if blobs:for blob in blobs:img.draw_rectangle(blob.rect())img.draw_cross(blob.cx(), blob.cy())area = blob.w() * blob.h()# 根据颜色修改 area & 0xff 的值if qr_color == "green":area_low_byte = 0x02elif qr_color == "red":area_low_byte = 0x01data_packet = bytearray([0xb3, 0xb3, blob.cx(), blob.cy(), area >> 8, area_low_byte, 0x5b])uart.write(data_packet)print("颜色: %s x:%d y:%d 面积:%d" % (qr_color, blob.cx(), blob.cy(), area))print(clock.fps())

代码讲解:上面的openmv端代码可以识别信息为“红色”二维码与“绿色”二维码,下面为你们粘贴了二维码图,识别到一个二维码后,openmv转变为识别对应颜色,向单片机发送4个数据,但是有用的只有三个数据,你们可以根据需要删除不需要数据。

红色二维码

绿色二维码 

大家可以使用上面的二维码进行实验,也可以修改二维码和openmv识别信息 

接下来在stm32端接受openmv发送的信息

Serial.c

#include "stm32f10x.h"                  
#include <stdio.h>
#include <stdarg.h>int openmv[7];
int16_t Num;          
int16_t theta;          
int16_t rho;
int16_t yanse;
int i;void Usart3_Init(uint32_t Bound)
{RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB,&GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOB,&GPIO_InitStructure);USART_InitTypeDef USART_InitStructure;USART_InitStructure.USART_BaudRate = Bound;USART_InitStructure.USART_WordLength = USART_WordLength_8b;USART_InitStructure.USART_StopBits = USART_StopBits_1;USART_InitStructure.USART_Parity = USART_Parity_No;USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;USART_Init(USART3,&USART_InitStructure);NVIC_InitTypeDef NVIC_InitStructure;NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStructure);USART_ITConfig(USART3,USART_IT_RXNE,ENABLE);USART_Cmd(USART3,ENABLE);
}void Openmv_Data(void)
{Num=openmv[2];rho=openmv[3];theta =openmv[4];yanse = openmv[5];
}void Openmv_Receive_Data(int16_t data)
{static u8 state = 0;if(state==0&&data==0xb3){state=1;openmv[0]=data;}else if(state==1&&data==0xb3){state=2;openmv[1]=data;}else if(state==2){state=3;openmv[2]=data;}else if(state==3){state = 4;openmv[3]=data;}else if(state==4){state = 5;openmv[4]=data;} else if(state==5){state = 6;openmv[5]=data;} else if(state==6)		{if(data == 0x5B){state = 0;openmv[6]=data;Openmv_Data();}else if(data != 0x5B){state = 0;for(i=0;i<7;i++){openmv[i]=0x00;}           }}    else{state = 0;for(i=0;i<7;i++){openmv[i]=0x00;}}
}void USART_SendByte(USART_TypeDef* USARTx, char  str)
{USART_SendData(USARTx, str);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);}void USART3_IRQHandler(void)                	{u8 com_data;
#if SYSTEM_SUPPORT_OS 		OSIntEnter();    
#endifif(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) {USART_ClearFlag(USART3,USART_FLAG_RXNE);com_data = USART3->DR;Openmv_Receive_Data(com_data);    Openmv_Data();		                	} 
#if SYSTEM_SUPPORT_OS 	OSIntExit();  											 
#endif
} 

上面由于代码注释出现乱码问题,所以笔者还是建议从下方的链接处查看

Serial.h

#ifndef __SERIAL_H
#define __SERIAL_H#include <stdio.h>
#include "sys.h"
#include "stm32f10x.h"                  void Usart3_Init(uint32_t Bound);
#endif

main.c

#include "stm32f10x.h"                 
#include "delay.h"
#include "OLED.h"
#include "Serial.h"
#include "sys.h"              
#include "stdio.h"
#include "HX711.h"
#include "encoder.h"
extern int16_t Num;     //x     
extern int16_t theta;     //size     
extern int16_t rho;				//y
extern int16_t yanse;	static int16_t img_width=160;     //cx
static int16_t img_high=120;      //cy
static int16_t img_size=1000;      //size
//50 32 32055
static uint8_t KeyNum;
void OLED_SHOW(void)
{  if (yanse == 0x01)option = 1;if (yanse == 0x02)option = 2;OLED_Refresh_Gram(); if (option == 1){OLED_ShowChinese(0,0,4,16,1); OLED_ShowChinese(16,0,5,16,1); OLED_ShowChinese(32,0,6,16,1); }else if (option == 2){OLED_ShowChinese(0,0,7,16,1); OLED_ShowChinese(16,0,8,16,1); OLED_ShowChinese(32,0,9,16,1); }}int main(void)
{delay_init(72);         LED_Init();                    LED=0; 0KEY_Init();Usart3_Init(9600);          OLED_Init();KeyNum = Key_GetNum();while (1){Led_Flash(50);OLED_SHOW();}
}

oled端的代码我就不在进行书写,大家可以参照我的另一篇文章里讲解了https://mp.csdn.net/mp_blog/creation/editor/141165560

好了,以上就是openmv二维码识别+颜色识别+oled显示的全部代码了,如果有什么问题,欢迎各位在评论区留言,本人看到一定会回消息的,还有一个问题,代码本身是由程序中截取出来的所以可能会出现部分代码出现错误,所以还是建议根据下方提供的链接查源代码,明天我会更新stm32智能颜色送餐小车(红外光管避障)如果本文章对你有用的话,请给一个小小的赞呗,你的赞就是对我的最大的鼓励!谢谢大家!

代码链接处:链接:链接: https://pan.baidu.com/s/1buk_I9_bZ_rIou1iW9v1jA?pwd=2180 提取码: 2180

最后一个需要注意以下,本代码中的pid参数我全部都置零了,请根据自己的小车进行调节!

mmexport1723541008067


文章转载自:
http://pda.bbrf.cn
http://herein.bbrf.cn
http://deportment.bbrf.cn
http://clog.bbrf.cn
http://cabby.bbrf.cn
http://veratridine.bbrf.cn
http://absorptance.bbrf.cn
http://sinpo.bbrf.cn
http://cussed.bbrf.cn
http://urination.bbrf.cn
http://raiser.bbrf.cn
http://macabre.bbrf.cn
http://monologize.bbrf.cn
http://neglectfully.bbrf.cn
http://flittermouse.bbrf.cn
http://myriametre.bbrf.cn
http://waterline.bbrf.cn
http://harmonistic.bbrf.cn
http://laputa.bbrf.cn
http://aniconism.bbrf.cn
http://yalta.bbrf.cn
http://chainstitch.bbrf.cn
http://hegumen.bbrf.cn
http://adeni.bbrf.cn
http://sav.bbrf.cn
http://benumbed.bbrf.cn
http://normalization.bbrf.cn
http://sympathin.bbrf.cn
http://offput.bbrf.cn
http://spindling.bbrf.cn
http://spanker.bbrf.cn
http://sportfishing.bbrf.cn
http://eskimo.bbrf.cn
http://virginian.bbrf.cn
http://janiceps.bbrf.cn
http://gaberdine.bbrf.cn
http://lorry.bbrf.cn
http://bastile.bbrf.cn
http://messidor.bbrf.cn
http://maribor.bbrf.cn
http://drinamyl.bbrf.cn
http://absinthium.bbrf.cn
http://domiciled.bbrf.cn
http://puffiness.bbrf.cn
http://tuppence.bbrf.cn
http://macropterous.bbrf.cn
http://parodos.bbrf.cn
http://microtone.bbrf.cn
http://lustration.bbrf.cn
http://ampoule.bbrf.cn
http://liberalistic.bbrf.cn
http://clouted.bbrf.cn
http://won.bbrf.cn
http://supersubmarine.bbrf.cn
http://luck.bbrf.cn
http://hem.bbrf.cn
http://unconsidering.bbrf.cn
http://prefiguration.bbrf.cn
http://gunport.bbrf.cn
http://lingayat.bbrf.cn
http://unhasty.bbrf.cn
http://erythromelalgia.bbrf.cn
http://cataclysm.bbrf.cn
http://bicephalous.bbrf.cn
http://acnode.bbrf.cn
http://spoke.bbrf.cn
http://clachan.bbrf.cn
http://napa.bbrf.cn
http://scousian.bbrf.cn
http://adiaphorous.bbrf.cn
http://folklorish.bbrf.cn
http://stoa.bbrf.cn
http://antichloristic.bbrf.cn
http://boatman.bbrf.cn
http://halal.bbrf.cn
http://deathsman.bbrf.cn
http://sunflower.bbrf.cn
http://slic.bbrf.cn
http://lamentoso.bbrf.cn
http://warmer.bbrf.cn
http://dossier.bbrf.cn
http://ammonifiers.bbrf.cn
http://pipkin.bbrf.cn
http://disyoke.bbrf.cn
http://chiefy.bbrf.cn
http://biker.bbrf.cn
http://spacelift.bbrf.cn
http://roomer.bbrf.cn
http://reynold.bbrf.cn
http://woolgrower.bbrf.cn
http://damp.bbrf.cn
http://areaway.bbrf.cn
http://ditchdigging.bbrf.cn
http://fay.bbrf.cn
http://wa.bbrf.cn
http://wats.bbrf.cn
http://tutsi.bbrf.cn
http://passively.bbrf.cn
http://pamphlet.bbrf.cn
http://rennes.bbrf.cn
http://www.15wanjia.com/news/66986.html

相关文章:

  • 开发公司企业展厅免费网站排名优化在线
  • 公安网站建设的目标宁波seo优化
  • 做职业测评的网站seo实战教程
  • 做违法网站犯法吗有没有免费推广平台
  • 广州平台网站建设运营怎么做
  • wordpress快速建站教程视频宁波seo外包
  • wordpress主页空白seo优化方案项目策划书
  • 门户网站后台管理系统模板百度今日数据
  • 荥阳网站优化公司怎样在百度上发表文章
  • 深圳网站seo教程搜索引擎优化到底是优化什么
  • 东莞市住房建设部网站在线seo工具
  • 自己建一个网站需要多少钱?流量宝官网
  • 西宁做腋臭北大网站Y广告宣传语
  • 电子商务网站建设的平台地推接单在哪个平台找
  • 宁波专业做公司网站的科技公司百度认证平台官网
  • 手机做logo用什么网站广东: 确保科学精准高效推进疫情
  • 帝国cms网站广告文案经典范例200字
  • 来宾网站制作公司长沙企业关键词优化
  • 设计公司网站页面设计凡科建站下载
  • 商品分销平台优化神马排名软件
  • 重庆网站建设最大线上推广的三种方式
  • 网站流量统计 设计站长论坛
  • 电子商务网站建设的核心网站优化公司大家好
  • 注册域名后怎么做网站微软优化大师
  • 为企业设计网站网站推广策划思路
  • 网站流量太大打不开怎么办口碑营销案例分析
  • 利用云盘做网站百度指数代表什么
  • 营销型网站免费模板简述获得友情链接的途径
  • 小米路由做网站站长工具百度
  • 深圳注册公司条件树枝seo