基于stm32开发的红外循迹小车

本项目算是接触32来开发的第一个小项目了,虽然前期用51写过一个循迹小车,以为直接转到32会比较简单,结果还是花了大几天才把小车的参数完全调完,以此来记录下自己的学习历程(注:循迹算法并未加入PID算法)

所需原件及其模块:

1.stm32c8t6最小系统板:

2.红外循迹模块(可以只用一个五路循迹模块,不需要单个的循迹模块,使用单个循迹模块是因为需要检测起始线(比赛题目要求))

五路循迹模块:

单个循迹模块:

3.车模底板:

4.L298N电机驱动模块(不能直接用单片机给电机供电,需要用一个驱动模块):

5.TT马达(直流电机):

6.面包板(便于插线,单片机的接口不够用的时候使用面包板可以很好的解决这个问题):

7.0.96寸OLED屏:

具体介绍每个原件及模块的用法:

1.红外循迹模块:检测黑线的原理是向外发射红外线,当没有遇到黑线的时候,返回回来,之后返回高电平,当遇到黑线的时候,红外被吸收,返回高电平,读取相应IO口的电平就可以知道小车此时的大致位置;

2.L298N电机驱动模块:分别是5V,12V,GND,可以通过外加电源给驱动模块供电,IN1,IN2,IN3,IN4,EN1,EN2,通过给IN口不同的电平,可以达到控制电机正反转,EN口为使能口,可以通过给EN口不同的PWM波,来达到控制小车速度,模块有四个输入接口,分别连接四个TT马达,驱动小车运动;PWM波:通过定时器来控制占空比,从而达到宏观上控速的现象;

源码程序:

wheel.c:

#include "wheel.h"void wheel_Init(){RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Pin = IN1 | IN2 | IN3 | IN4;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructure);
}void Car_Go(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(100);//右轮速度PWM_SetCompare3(100);}void Stop(){//左轮速度PWM_SetCompare2(0);//右轮速度PWM_SetCompare3(0);
}void Car_GoLeft(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(50);//右轮速度PWM_SetCompare3(55);}void Car_GoRight(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(55);//右轮速度PWM_SetCompare3(50);}void TurnLeft_Slow(){//左轮向后GPIO_ResetBits(GPIOA, IN1);GPIO_SetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(75);//右轮速度PWM_SetCompare3(75);
}void TurnRight_Slow(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向后GPIO_ResetBits(GPIOA, IN3);GPIO_SetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(75);//右轮速度PWM_SetCompare3(75);
}void TurnLeft_Fast(){//左轮向后GPIO_ResetBits(GPIOA, IN1);GPIO_SetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(70);//右轮速度PWM_SetCompare3(70);
}void TurnRight_Fast(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向后GPIO_ResetBits(GPIOA, IN3);GPIO_SetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(70);//右轮速度PWM_SetCompare3(70);
}void Angle_Left(){//左轮向后GPIO_ResetBits(GPIOA, IN1);GPIO_SetBits(GPIOA, IN2);//右轮向前GPIO_SetBits(GPIOA, IN3);GPIO_ResetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(90);//右轮速度PWM_SetCompare3(90);
}void Angle_Right(){//左轮向前GPIO_SetBits(GPIOA, IN1);GPIO_ResetBits(GPIOA, IN2);//右轮向后GPIO_ResetBits(GPIOA, IN3);GPIO_SetBits(GPIOA, IN4);//左轮速度PWM_SetCompare2(90);//右轮速度PWM_SetCompare3(90);
}

wheel.h:

#ifndef __WHEEL_H
#define __WHEEL_H#include "stm32f10x.h"  
#include "PWM.h"/*  IN1 PA5IN2 PA6IN3 PA3IN4 PA4
*/
#define IN1 GPIO_Pin_5
#define IN2 GPIO_Pin_6
#define IN3 GPIO_Pin_3
#define IN4 GPIO_Pin_4void wheel_Init();//初始化车轮
void Car_Go();//向前
void Stop();//停车
void Car_GoLeft();//当小车车身略偏右的时候,右轮速度略大于左轮,可以使小车回到正轨
void Car_GoRight();//当小车车身略偏左的时候,右轮速度略大于左轮,可以使小车回到正轨
void TurnLeft_Slow();//慢左转
void TurnRight_Slow();//慢右转
void TurnLeft_Fast();//快左转
void TurnRight_Fast();//快右转
void Angle_Left();//向左转直角弯
void Angle_Right();//向右转直角弯
#endif

PWM.c:

#include "PWM.h"//采用定时器TIM2的通道2,通道3输出PWM波,分别控制左右轮速度
void PWM_Init(void)
{RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_1;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructure);TIM_InternalClockConfig(TIM2);TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;TIM_TimeBaseInitStructure.TIM_Period = 150 - 1;		//ARRTIM_TimeBaseInitStructure.TIM_Prescaler = 1 - 1;		//PSCTIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;TIM_TimeBaseInit(TIM2, &TIM_TimeBaseInitStructure);TIM_OCInitTypeDef TIM_OCInitStructure;TIM_OCStructInit(&TIM_OCInitStructure);TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;TIM_OCInitStructure.TIM_Pulse = 0;		//CCRTIM_OC3Init(TIM2, &TIM_OCInitStructure);TIM_OC2Init(TIM2, &TIM_OCInitStructure);TIM_Cmd(TIM2, ENABLE);
}//左轮调速
void PWM_SetCompare2(uint16_t Compare)
{TIM_SetCompare2(TIM2, Compare);
}//右轮调速
void PWM_SetCompare3(uint16_t Compare)
{TIM_SetCompare3(TIM2, Compare);
}

PWM.h:

#ifndef __PWM_H
#define __PWM_H#include "stm32f10x.h"  /*EN1  PA2(右轮调速)EN2  PA1(左轮调速)
*/
void PWM_Init();
void PWM_SetCompare2(uint16_t Compare);
void PWM_SetCompare3(uint16_t Compare);#endif

Trace.c:讲解一下循迹代码,就是当检测到某一个具体的状态时,需要小车做出相应的反应来维护小车始终在黑线上,比如,假设此时的状态为(!DET1 && DET2 && DET3 && DET4 && DET5)即红外循迹模块检测到电平为01111,则此时黑线在小车左边,需要快速将小车左转,则我们可以将小车的左轮向后转,右轮向前转,就可以很好的转向了,此外当小车速度过快的时候,可能刚检测到黑线的时候,由于小车没反应过来,车身已经冲出赛道了,我们可以另外用一个算法来维护,假设我们冲出赛道的时候是向左转,则一旦冲出赛道(即红外循迹模块电平为11111)此时可以持续小车左转的状态,直到小车自行转到赛道上,可以继续沿着赛道循迹,当然此方法只是没学PID算法的一种下策,并不能很流畅的解决所有赛道

#include "Trace.h"//Flag标志位,用于存放小车偏离轨道时的上一个状态,Flag为一则上次为左转,Flag为2则上次为右转
unsigned int Flag=0;
//StopFlag标志位判断小车是否为第一次经过起始线
unsigned int StopFlag=0;
void Trace_Init(){GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB,&GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 |  GPIO_Pin_12 | GPIO_Pin_7;GPIO_Init(GPIOA,&GPIO_InitStructure);
}//0为黑线
void Trace(){if(DET1 && DET2 && !DET3 && DET4 && DET5) {Car_Go();Flag=0;}//11011if(DET1 && !DET2 && !DET3 && !DET4 && DET5) {Car_Go();Flag=0;}//10001if(DET1 && !DET2 && DET3 && DET4 && DET5)	{Car_GoLeft();Flag=1;}//10111if(DET1 && !DET2 && !DET3 && DET4 && DET5) {Car_GoLeft();Flag=1;}//10011if(!DET1 && DET2 && DET3 && DET4 && DET5) {TurnLeft_Fast();Flag=1;}//01111if(!DET1 && !DET2 && DET3 && DET4 && DET5) {Angle_Left();Flag=1;}//00111if(!DET1 && !DET2 && !DET3 && DET4 && DET5) {Angle_Left();Flag=1;}//00011if(!DET1 && !DET2 && !DET3 && !DET4 && DET5)	{Angle_Left();Flag=1;}//00001if(DET1 && DET2 && DET3 && !DET4 && DET5) {Car_GoRight();Flag=2;}//11101if(DET1 && DET2 && !DET3 && !DET4 && DET5) {Car_GoRight();Flag=2;}//11001if(DET1 && DET2 && DET3 && DET4 && !DET5) {TurnRight_Fast();Flag=2;}//11110if(DET1 && DET2 && DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//11100if(DET1 && DET2 && !DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//11000if(DET1 && !DET2 && !DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//10000if(!DET1 && !DET2 && !DET3 && !DET4 && !DET5) {Car_Go();Flag=0;}//00000if(DET1 && DET2 && DET3 && DET4 && DET5){if(!Flag){Car_Go();Flag=0;}if(Flag==1){TurnLeft_Fast();Flag=1;}if(Flag==2){TurnRight_Fast();Flag=2;}}
}//判断小车是否为第一次经过起始线,当第二次经过时停止
int Car_State(){if(DETLeft && DETRight){while(DETLeft && DETRight){}if(!StopFlag){StopFlag=1;return 0;}elsereturn 1;}return 0;
}

Trace.h:

#ifndef __TRACE_H
#define __TRACE_H#include "stm32f10x.h"  
#include "wheel.h"
#include "PWM.h"//从左到右红外循迹模块依次
#define DETLeft   GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_12)
#define DETRight  GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_7)
#define DET1      GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_15)
#define DET2      GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_4)
#define DET3      GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_5)
#define DET4      GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_6)
#define DET5      GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_7)
void Trace_Init();
void Trace();
int Car_State();#endif

OLED.c:

#include "stm32f10x.h"
#include "OLED_Font.h"/*引脚配置*/
#define OLED_W_SCL(x)		GPIO_WriteBit(GPIOB, GPIO_Pin_8, (BitAction)(x))
#define OLED_W_SDA(x)		GPIO_WriteBit(GPIOB, GPIO_Pin_9, (BitAction)(x))/*引脚初始化*/
void OLED_I2C_Init(void)
{RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;GPIO_Init(GPIOB, &GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;GPIO_Init(GPIOB, &GPIO_InitStructure);OLED_W_SCL(1);OLED_W_SDA(1);
}/*** @brief  I2C开始* @param  无* @retval 无*/
void OLED_I2C_Start(void)
{OLED_W_SDA(1);OLED_W_SCL(1);OLED_W_SDA(0);OLED_W_SCL(0);
}/*** @brief  I2C停止* @param  无* @retval 无*/
void OLED_I2C_Stop(void)
{OLED_W_SDA(0);OLED_W_SCL(1);OLED_W_SDA(1);
}/*** @brief  I2C发送一个字节* @param  Byte 要发送的一个字节* @retval 无*/
void OLED_I2C_SendByte(uint8_t Byte)
{uint8_t i;for (i = 0; i < 8; i++){OLED_W_SDA(Byte & (0x80 >> i));OLED_W_SCL(1);OLED_W_SCL(0);}OLED_W_SCL(1);	//额外的一个时钟,不处理应答信号OLED_W_SCL(0);
}/*** @brief  OLED写命令* @param  Command 要写入的命令* @retval 无*/
void OLED_WriteCommand(uint8_t Command)
{OLED_I2C_Start();OLED_I2C_SendByte(0x78);		//从机地址OLED_I2C_SendByte(0x00);		//写命令OLED_I2C_SendByte(Command); OLED_I2C_Stop();
}/*** @brief  OLED写数据* @param  Data 要写入的数据* @retval 无*/
void OLED_WriteData(uint8_t Data)
{OLED_I2C_Start();OLED_I2C_SendByte(0x78);		//从机地址OLED_I2C_SendByte(0x40);		//写数据OLED_I2C_SendByte(Data);OLED_I2C_Stop();
}/*** @brief  OLED设置光标位置* @param  Y 以左上角为原点,向下方向的坐标,范围:0~7* @param  X 以左上角为原点,向右方向的坐标,范围:0~127* @retval 无*/
void OLED_SetCursor(uint8_t Y, uint8_t X)
{OLED_WriteCommand(0xB0 | Y);					//设置Y位置OLED_WriteCommand(0x10 | ((X & 0xF0) >> 4));	//设置X位置高4位OLED_WriteCommand(0x00 | (X & 0x0F));			//设置X位置低4位
}/*** @brief  OLED清屏* @param  无* @retval 无*/
void OLED_Clear(void)
{  uint8_t i, j;for (j = 0; j < 8; j++){OLED_SetCursor(j, 0);for(i = 0; i < 128; i++){OLED_WriteData(0x00);}}
}/*** @brief  OLED显示一个字符* @param  Line 行位置,范围:1~4* @param  Column 列位置,范围:1~16* @param  Char 要显示的一个字符,范围:ASCII可见字符* @retval 无*/
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char)
{      	uint8_t i;OLED_SetCursor((Line - 1) * 2, (Column - 1) * 8);		//设置光标位置在上半部分for (i = 0; i < 8; i++){OLED_WriteData(OLED_F8x16[Char - ' '][i]);			//显示上半部分内容}OLED_SetCursor((Line - 1) * 2 + 1, (Column - 1) * 8);	//设置光标位置在下半部分for (i = 0; i < 8; i++){OLED_WriteData(OLED_F8x16[Char - ' '][i + 8]);		//显示下半部分内容}
}
void OLED_ShowChinese(uint8_t Line, uint8_t Column, uint8_t num)
{      	uint8_t i;OLED_SetCursor((Line - 1) * 2, (Column - 1) * 8);		//设置光标位置在上半部分for (i = 0; i < 8; i++){OLED_WriteData(OLED_chinese[num][i]);			//显示上半部分内容}OLED_SetCursor((Line - 1) * 2 + 1, (Column - 1) * 8);	//设置光标位置在下半部分for (i = 0; i < 8; i++){OLED_WriteData(OLED_chinese[num][i + 8]);		//显示下半部分内容}
}
void OLDE_ShowChinese2(uint8_t Line, uint8_t Column, uint8_t num)
{OLED_ShowChinese(Line,Column,num);OLED_ShowChinese(Line,Column+1,num+1);
}/*** @brief  OLED显示字符串* @param  Line 起始行位置,范围:1~4* @param  Column 起始列位置,范围:1~16* @param  String 要显示的字符串,范围:ASCII可见字符* @retval 无*/
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String)
{uint8_t i;for (i = 0; String[i] != '\0'; i++){OLED_ShowChar(Line, Column + i, String[i]);}
}/*** @brief  OLED次方函数* @retval 返回值等于X的Y次方*/
uint32_t OLED_Pow(uint32_t X, uint32_t Y)
{uint32_t Result = 1;while (Y--){Result *= X;}return Result;
}/*** @brief  OLED显示数字(十进制,正数)* @param  Line 起始行位置,范围:1~4* @param  Column 起始列位置,范围:1~16* @param  Number 要显示的数字,范围:0~4294967295* @param  Length 要显示数字的长度,范围:1~10* @retval 无*/
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{uint8_t i;for (i = 0; i < Length; i++)							{OLED_ShowChar(Line, Column + i, Number / OLED_Pow(10, Length - i - 1) % 10 + '0');}
}/*** @brief  OLED显示数字(十进制,带符号数)* @param  Line 起始行位置,范围:1~4* @param  Column 起始列位置,范围:1~16* @param  Number 要显示的数字,范围:-2147483648~2147483647* @param  Length 要显示数字的长度,范围:1~10* @retval 无*/
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int32_t Number, uint8_t Length)
{uint8_t i;uint32_t Number1;if (Number >= 0){OLED_ShowChar(Line, Column, '+');Number1 = Number;}else{OLED_ShowChar(Line, Column, '-');Number1 = -Number;}for (i = 0; i < Length; i++)							{OLED_ShowChar(Line, Column + i + 1, Number1 / OLED_Pow(10, Length - i - 1) % 10 + '0');}
}/*** @brief  OLED显示数字(十六进制,正数)* @param  Line 起始行位置,范围:1~4* @param  Column 起始列位置,范围:1~16* @param  Number 要显示的数字,范围:0~0xFFFFFFFF* @param  Length 要显示数字的长度,范围:1~8* @retval 无*/
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{uint8_t i, SingleNumber;for (i = 0; i < Length; i++)							{SingleNumber = Number / OLED_Pow(16, Length - i - 1) % 16;if (SingleNumber < 10){OLED_ShowChar(Line, Column + i, SingleNumber + '0');}else{OLED_ShowChar(Line, Column + i, SingleNumber - 10 + 'A');}}
}/*** @brief  OLED显示数字(二进制,正数)* @param  Line 起始行位置,范围:1~4* @param  Column 起始列位置,范围:1~16* @param  Number 要显示的数字,范围:0~1111 1111 1111 1111* @param  Length 要显示数字的长度,范围:1~16* @retval 无*/
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{uint8_t i;for (i = 0; i < Length; i++)							{OLED_ShowChar(Line, Column + i, Number / OLED_Pow(2, Length - i - 1) % 2 + '0');}
}/*** @brief  OLED初始化* @param  无* @retval 无*/
void OLED_Init(void)
{uint32_t i, j;for (i = 0; i < 1000; i++)			//上电延时{for (j = 0; j < 1000; j++);}OLED_I2C_Init();			//端口初始化OLED_WriteCommand(0xAE);	//关闭显示OLED_WriteCommand(0xD5);	//设置显示时钟分频比/振荡器频率OLED_WriteCommand(0x80);OLED_WriteCommand(0xA8);	//设置多路复用率OLED_WriteCommand(0x3F);OLED_WriteCommand(0xD3);	//设置显示偏移OLED_WriteCommand(0x00);OLED_WriteCommand(0x40);	//设置显示开始行OLED_WriteCommand(0xA1);	//设置左右方向,0xA1正常 0xA0左右反置OLED_WriteCommand(0xC8);	//设置上下方向,0xC8正常 0xC0上下反置OLED_WriteCommand(0xDA);	//设置COM引脚硬件配置OLED_WriteCommand(0x12);OLED_WriteCommand(0x81);	//设置对比度控制OLED_WriteCommand(0xCF);OLED_WriteCommand(0xD9);	//设置预充电周期OLED_WriteCommand(0xF1);OLED_WriteCommand(0xDB);	//设置VCOMH取消选择级别OLED_WriteCommand(0x30);OLED_WriteCommand(0xA4);	//设置整个显示打开/关闭OLED_WriteCommand(0xA6);	//设置正常/倒转显示OLED_WriteCommand(0x8D);	//设置充电泵OLED_WriteCommand(0x14);OLED_WriteCommand(0xAF);	//开启显示OLED_Clear();				//OLED清屏
}

OLED.h:

#ifndef __OLED_H
#define __OLED_Hvoid OLED_Init(void);
void OLED_Clear(void);
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char);
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String);
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int32_t Number, uint8_t Length);
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowChinese(uint8_t Line, uint8_t Column, uint8_t num);
void OLDE_ShowChinese2(uint8_t Line, uint8_t Column, uint8_t num);
#endif

OLED_Font.h(字模库)(该字库为取模软件生成,若有想展示的字可以自行取模):

#ifndef __OLED_FONT_H
#define __OLED_FONT_H
const uint8_t OLED_chinese[][16]={//注意第二行和第三行要调转一下位置
0x20,0x20,0x24,0x24,0x24,0xA4,0x24,0x24,
0x40,0xC0,0x7E,0x40,0x40,0x3F,0x22,0x22,
0x20,0xFF,0x20,0x22,0x2C,0x20,0x20,0x00,
0x20,0x03,0x0C,0x10,0x20,0x40,0xF8,0x00,/*"武",0*/0x10,0x60,0x02,0x0C,0xC0,0x02,0x1E,0xE2,
0x04,0x04,0x7C,0x03,0x80,0x80,0x40,0x20,
0x02,0x02,0x02,0xE2,0x1E,0x00,0x00,0x00,
0x13,0x0C,0x13,0x20,0x40,0x80,0x80,0x00,/*"汉",2*/0x00,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,
0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*"工",4*/0x24,0x24,0xA4,0xFE,0x23,0x22,0x00,0x3E,
0x08,0x06,0x01,0xFF,0x01,0x06,0x40,0x49,
0x22,0x22,0x22,0x22,0x22,0x3E,0x00,0x00,
0x49,0x49,0x7F,0x49,0x49,0x49,0x41,0x00,/*"程",6*/0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,
0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00,/*"大",8*/0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,
0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,
0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00,/*"学",10*/0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,
0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x7F,
0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00,
0x88,0x88,0x88,0x88,0x9F,0x80,0xF0,0x00,/*"电",12*/0x20,0x10,0x4C,0x47,0x54,0x54,0x54,0x54,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x54,0x54,0x54,0xD4,0x04,0x04,0x00,0x00,
0x00,0x00,0x00,0x0F,0x30,0x40,0xF0,0x00,/*"气",14*/0x00,0x80,0x60,0xF8,0x07,0x00,0x04,0x24,
0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xF9,
0x24,0x25,0x26,0x24,0x24,0x24,0x04,0x00,
0x49,0x49,0x49,0x49,0x49,0xF9,0x00,0x00,/*"信",16*/0x00,0x00,0x00,0xFC,0x54,0x54,0x56,0x55,
0x40,0x30,0x00,0x03,0x39,0x41,0x41,0x45,
0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x59,0x41,0x41,0x73,0x00,0x08,0x30,0x00,/*"息",18*/0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,
0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,
0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00,/*"学",20*/0x00,0xFE,0x22,0x5A,0x86,0x10,0x0C,0x24,
0x00,0xFF,0x04,0x08,0x07,0x80,0x41,0x31,
0x24,0x25,0x26,0x24,0x24,0x14,0x0C,0x00,
0x0F,0x01,0x01,0x3F,0x41,0x41,0x71,0x00,/*"院",22*/0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,
0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x7F,
0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00,
0x88,0x88,0x88,0x88,0x9F,0x80,0xF0,0x00,/*"电",24*/0x80,0x82,0x82,0x82,0x82,0x82,0x82,0xE2,
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,
0xA2,0x92,0x8A,0x86,0x82,0x80,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"子",26*/0x00,0x80,0x60,0xF8,0x07,0x00,0x04,0x24,
0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xF9,
0x24,0x25,0x26,0x24,0x24,0x24,0x04,0x00,
0x49,0x49,0x49,0x49,0x49,0xF9,0x00,0x00,/*"信",28*/0x00,0x00,0x00,0xFC,0x54,0x54,0x56,0x55,
0x40,0x30,0x00,0x03,0x39,0x41,0x41,0x45,
0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x59,0x41,0x41,0x73,0x00,0x08,0x30,0x00,/*"息",30*/0x00,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,
0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*"工",32*/0x24,0x24,0xA4,0xFE,0x23,0x22,0x00,0x3E,
0x08,0x06,0x01,0xFF,0x01,0x06,0x40,0x49,
0x22,0x22,0x22,0x22,0x22,0x3E,0x00,0x00,
0x49,0x49,0x7F,0x49,0x49,0x49,0x41,0x00,//"程",34*};
/*OLED字模库,宽8像素,高16像素*/
const uint8_t OLED_F8x16[][16]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//  00x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 10x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 20x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 30x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 40xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 50x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 60x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 70x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 80x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 90x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 100x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 110x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 120x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 130x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 140x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 150x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 160x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 170x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 180x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 190x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 200x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 210x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 220x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 230x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 240x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 250x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 260x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 270x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 280x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 290x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 300x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 310xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 320x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 330x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 340xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 350x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 360x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 370x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 380xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 390x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 400x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 410x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 420x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 430x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 440x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 450x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 460xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 470x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 480xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 490x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 500x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 510x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 520x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 530x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 540xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 550x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 560x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 570x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 580x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 590x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 600x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 610x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 620x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 630x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 640x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 650x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 660x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 670x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 680x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 690x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 700x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 710x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 720x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 730x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 740x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 750x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 760x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 770x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 780x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 790x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 800x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 810x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 820x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 830x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 840x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 850x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 860x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 870x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 880x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 890x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 900x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 910x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 920x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 930x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};#endif

最后将小车的布线及演示展示于下:

小车循迹演示

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/868679.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

spring boot集成easypoi导出word换行处理

项目场景&#xff1a; spring boot集成easypoi导出word <dependency><groupId>cn.afterturn</groupId><artifactId>easypoi-spring-boot-starter</artifactId><version>4.4.0</version> </dependency> 问题描述 spring boo…

最新的 DL/T645 调试工具,工程师必备

分享一个好用的 DL/T645 调试工具&#xff0c;下载地址&#xff1a;https://www.redisant.cn/dl645master 文章目录 最新的 DL/T645 调试工具&#xff0c;工程师必备主要功能软件截图 最新的 DL/T645 调试工具&#xff0c;工程师必备 DL/T645 是中国电力行业的一个通信协议标准…

Day47:LeedCode1143.最长公共子序列 1035.不相交的线 53. 最大子序和 392.判断子序列

1143. 最长公共子序列 给定两个字符串 text1 和 text2&#xff0c;返回这两个字符串的最长 公共子序列 的长度。如果不存在 公共子序列 &#xff0c;返回 0 。 一个字符串的 子序列 是指这样一个新的字符串&#xff1a;它是由原字符串在不改变字符的相对顺序的情况下删除某些字…

解决uni-app中全局设置页面背景颜色只有部分显示颜色的问题

在页面的style标签设置了背景色但是只显示一部分 <style lang"scss"> .content{background-color: #f7f7f7;height: 100vh; } </style>我们在app.vue里设置就行了 注意一定要是**page{}** <style>/*每个页面公共css */page{background-color: #…

淘宝商品评论电商API接口:提升销量与用户评论的策略

一、API接口简介 淘宝商品评论电商API接口是淘宝开放平台提供的一项服务&#xff0c;联讯数据通过这个接口&#xff0c;商家可以获取关于自己商品的评论数据&#xff0c;包括评论内容、评分、买家等级等信息。这些数据可以帮助商家更好地了解消费者需求&#xff0c;优化商品和服…

724.力扣每日一题7/8 Java

博客主页&#xff1a;音符犹如代码系列专栏&#xff1a;算法练习关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ 目录 思路 解题方法 时间复杂度 空间复杂度 Code 思路 主要基于数组的…

linux主机离线安装python3环境

一、下载好python版本 Index of /ftp/python/https://www.python.org/ftp/python/ 二、创建文件夹 mkdir /home/python/ 三、上传到主机 四、解压 # 解压xz得到tar包 xz -d Python-3.9.8.tar.xz # 解压tar包 tar -xvf Python-3.9.8.tar 五、指定安装路径 # 进入解压后的…

【Python_GUI】tkinter常用组件——文本类组件

文本时窗口中必不可少的一部分&#xff0c;tkinter模块中&#xff0c;有3种常用的文本类组件&#xff0c;通过这3种组件&#xff0c;可以在窗口中显示以及输入单行文本、多行文本、图片等。 Label标签组件 Label组件的基本使用 Label组件是窗口中比较常用的组件&#xff0c;…

【LeetCode】有效的数独

目录 一、题目二、解法 一、题目 请你判断一个 9 x 9 的数独是否有效。只需要 根据以下规则 &#xff0c;验证已经填入的数字是否有效即可。 数字 1-9 在每一行只能出现一次。 数字 1-9 在每一列只能出现一次。 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。&…

智能充电(新能源电动车,电单车)云管理系统的定制解决方案

一 系统简介 智能充电&#xff08;新能源电动车&#xff0c;电单车&#xff09;云管理系统 是一套能够实现对充电站/桩的实时通讯、状态监控、故障检测、运营分析、数据统计、策略设置的智能化多任务管理系统。 二 平台概览 智能充电云管理系统 https://chongdianzhuang.itg…

嵌入式Linux系统编程 — 7.4 fork、vfork函数创建子进程

目录 1 父进程与子进程概念 2 fork创建子进程 3 系统调用 vfork()函数 4 vfork与 fork函数如何选择 1 父进程与子进程概念 进程与子进程是操作系统中的一个基本概念&#xff0c;用于描述进程之间的层级关系。下面是对这一概念的简要说明&#xff1a; 父进程&#xff1a;在…

从项目中初识Autosar状态机转换

目录 0 前言 1 状态转换 1.1 BSM TO RMS 1.2 RMS TO RSS 1.3 RMS TO NOS 1.4 RSS TO PBSM 1.5 PBSM TO BSM 1.6 RSS TO NOS 1.7 RSS TO RMS 2 结尾 0 前言 之前在这篇《从项目中初识Autosar网络管理》已经和大家讲了Autosar网络管理的几个状态机以及定时器的大致概念&a…

【网安播报】CocoaPods 曝关键漏洞,应用程序面临供应链攻击风险

1、CocoaPods 曝关键漏洞&#xff0c;数百万 macOS 和 iOS 应用程序面临供应链攻击风险 开源依赖管理器 CocoaPods 中的安全漏洞暴露了数千个软件包&#xff0c;利用这些漏洞的攻击者可以将恶意代码注入合法应用&#xff0c;通过受信任的渠道分发恶意软件&#xff0c;并破坏用户…

Qt QWizard新建向导实例

使用QWizard做新建向导&#xff0c;最简单的实例 class MyWizard : public QWizard { public: MyWizard(QWidget* parent nullptr); QWizardPage* createFirstPage(); QWizardPage* createSecondPage(); QWizardPage* createThirdPage(); }; MyWizard::MyWizard(QWidget* par…

最近点对问题(算法与数据结构设计)

课题内容和要求 最近点对问题&#xff0c;在二维平面上输入n个点列P。其中任一点pi&#xff08;xi&#xff0c;yi&#xff09;&#xff0c;编写程序求出最近的两个点。使用穷举法实现&#xff0c;算法复杂度O(n2)&#xff1b;优化算法&#xff0c;以O(nlog2n)实现这一问题 数…

静脉分割YOLOV8-SEG

静脉分割&#xff0c;YOLOV8*SEG资源-CSDN文库 首先使用YOLOV8-SEG训练&#xff0c;得到PT模型&#xff0c;然后转换成ONNX&#xff0c;OPENCV的DNN调用&#xff0c;从而摆脱PYTORCH依赖&#xff0c;支持C,PYTHON,ANDROID调用

Java信号量semaphore的原理与使用方法

Semaphore的基本概念 在Java中&#xff0c;Semaphore是位于java.util.concurrent包下的一个类。它的核心就是维护了一个许可集。简单来说&#xff0c;就是有一定数量的许可&#xff0c;线程需要先获取到许可&#xff0c;才能执行&#xff0c;执行完毕后再释放许可。 那么&…

尚品汇-(十五)

&#xff08;1&#xff09;快速入门 SpringBoot形式创建 Maven形式创建&#xff1a; 加入依赖&#xff1a; 创建启动类&#xff1a; 设置头文件 就想Jsp的<%Page %>一样 &#xff0c;Thymeleaf的也要引入标签规范。不加这个虽然不影响程序运行&#xff0c;但是你的idea…

顶会FAST24最佳论文|阿里云块存储架构演进的得与失-4.EBS不同架构性能提升思路

3.1 平均延迟与长尾延迟 虚拟磁盘&#xff08;VD&#xff09;的延迟是由其底层架构决定的&#xff0c;具体而言&#xff0c;取决于请求所经历的路径。以EBS2为例&#xff0c;VD的延迟受制于两跳网络&#xff08;从BlockClient到BlockServer&#xff0c;再至ChunkServer&#x…

Xilinx FPGA:vivado关于IIC的一些零碎知识点

一、简介 IlC(inter-Integrated circuit)总线是一种由NXP(原PHILIPS)公司开发的两线式串行总线&#xff0c;用于连接微控制器及其外围设备。多用于主控制器和从器件间的主从通信&#xff0c;在小数据量场合使用&#xff0c;传输距离短&#xff0c;任意时刻只能有一个主机等特性…