基于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 PA5
    IN2 PA6
    IN3 PA3
    IN4 PA4
*/
#define IN1 GPIO_Pin_5
#define IN2 GPIO_Pin_6
#define IN3 GPIO_Pin_3
#define IN4 GPIO_Pin_4

void 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;		//ARR
	TIM_TimeBaseInitStructure.TIM_Prescaler = 1 - 1;		//PSC
	TIM_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;		//CCR
	TIM_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;}//11011
	if(DET1 && !DET2 && !DET3 && !DET4 && DET5) {Car_Go();Flag=0;}//10001
	if(DET1 && !DET2 && DET3 && DET4 && DET5)	{Car_GoLeft();Flag=1;}//10111
	if(DET1 && !DET2 && !DET3 && DET4 && DET5) {Car_GoLeft();Flag=1;}//10011
	if(!DET1 && DET2 && DET3 && DET4 && DET5) {TurnLeft_Fast();Flag=1;}//01111
	if(!DET1 && !DET2 && DET3 && DET4 && DET5) {Angle_Left();Flag=1;}//00111
	if(!DET1 && !DET2 && !DET3 && DET4 && DET5) {Angle_Left();Flag=1;}//00011
	if(!DET1 && !DET2 && !DET3 && !DET4 && DET5)	{Angle_Left();Flag=1;}//00001
	if(DET1 && DET2 && DET3 && !DET4 && DET5) {Car_GoRight();Flag=2;}//11101
	if(DET1 && DET2 && !DET3 && !DET4 && DET5) {Car_GoRight();Flag=2;}//11001
	if(DET1 && DET2 && DET3 && DET4 && !DET5) {TurnRight_Fast();Flag=2;}//11110
	if(DET1 && DET2 && DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//11100
	if(DET1 && DET2 && !DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//11000
	if(DET1 && !DET2 && !DET3 && !DET4 && !DET5) {Angle_Right();Flag=2;}//10000
  if(!DET1 && !DET2 && !DET3 && !DET4 && !DET5) {Car_Go();Flag=0;}//00000
	if(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;
		  }
		  else
		 	  return 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_H

void 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,//  0
	
	0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
	
	0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
	
	0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,
	0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
	
	0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,
	0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
	
	0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,
	0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
	
	0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,
	0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
	
	0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
	
	0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,
	0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
	
	0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,
	0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
	
	0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,
	0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
	
	0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
	0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
	
	0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,
	0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
	
	0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
	0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
	
	0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
	
	0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,
	0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
	
	0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,
	0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
	
	0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,
	0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
	
	0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,
	0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
	
	0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,
	0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
	
	0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,
	0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
	
	0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,
	0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
	
	0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
	0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
	
	0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,
	0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
	
	0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
	0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
	
	0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,
	0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
	
	0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
	0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
	
	0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,
	0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
	
	0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,
	0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
	
	0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,
	0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
	
	0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,
	0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
	
	0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
	
	0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,
	0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
	
	0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
	
	0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
	0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
	
	0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
	0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
	
	0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,
	0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
	
	0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
	0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
	
	0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
	
	0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,
	0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
	
	0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,
	0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
	
	0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
	
	0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,
	0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
	
	0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,
	0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
	
	0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
	
	0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,
	0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
	
	0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
	
	0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,
	0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
	
	0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,
	0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
	
	0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,
	0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
	
	0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
	0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
	
	0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,
	0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
	
	0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,
	0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
	
	0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,
	0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
	
	0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,
	0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
	
	0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,
	0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
	
	0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,
	0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
	
	0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
	
	0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
	0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
	
	0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
	
	0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
	
	0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,
	0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
	
	0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,
	0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
	
	0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,
	0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
	
	0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
	
	0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,
	0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
	
	0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
	
	0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,
	0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
	
	0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,
	0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
	
	0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
	
	0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
	0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
	
	0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,
	0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
	
	0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,
	0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
	
	0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,
	0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
	
	0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
	0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
	
	0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,
	0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
	
	0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,
	0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
	
	0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
	0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
	
	0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,
	0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
	
	0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
	0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
	
	0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
	0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
	
	0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
	
	0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,
	0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
	
	0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
	
	0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,
	0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
	
	0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};


#endif

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

小车循迹演示

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

AI网络爬虫016:用deepseek批量提取coze扣子的智能体数据

文章目录 一、介绍二、输入内容三、输出内容一、介绍 动态加载页面,返回json数据: 翻页规律: https://www.coze.cn/api/marketplace 这两个URL在多个方面有所不同,主要差异如下: **查询参数(Query Parameters)**: - 第一个URL的查询参数包括: - `entity_type=1` - `…

【VUE基础】VUE3第七节—Vue Router路由基础

Vue Router 是 Vue 官方的客户端路由解决方案。 客户端路由的作用是在单页应用 (SPA) 中将浏览器的 URL 和用户看到的内容绑定起来。当用户在应用中浏览不同页面时&#xff0c;URL 会随之更新&#xff0c;但页面不需要从服务器重新加载。 Vue Router 基于 Vue 的组件系统构建&…

imazing电脑怎么下载 imazing怎么下载软件 使用iMazing下载和卸载Apple设备上的应用程序

iMazing官方版是一款管理苹果设备的软件&#xff0c;是一款帮助用户管理 iOS手机的PC端应用程序&#xff0c;能力远超 iTunes 提供的终极 iOS 设备管理器。在iMazing官方版上与苹果设备连接后&#xff0c;可以轻松传输文件&#xff0c;浏览保存信息等&#xff0c;功能比iTunes更…

rocketmq主从自动切换(Controller 嵌入 NameServer 部署)

rocketmq5以后&#xff0c;加入了主从自动切换的功能&#xff1a; 官网 https://rocketmq.apache.org/zh/docs/deploymentOperations/03autofailover 准备工作 1&#xff09;关闭将要升级的nameserver、master、slave 2&#xff09;复制master的store文件到其他两台机器&a…

240708_昇思学习打卡-Day20-MindNLP ChatGLM-6B StreamChat

240708_昇思学习打卡-Day20-MindNLP ChatGLM-6B StreamChat 基于MindNLP和ChatGLM-6B实现一个聊天应用&#xff0c;本文进行简单记录。 环境配置 %%capture captured_output # 实验环境已经预装了mindspore2.2.14&#xff0c;如需更换mindspore版本&#xff0c;可更改下面mi…

通过高德地图 JS API实现单击鼠标进行标注

效果图: 核心代码: <template><a-modal title="选择地图所在位置" :width="width" :visible="visible" @ok="handleOk" @cancel="handleCancel" cancelText="关闭"><div class="location-…

Flutter——最详细(Badge)使用教程

背景 主要常用于组件叠加上圆点提示&#xff1b; 使用场景&#xff0c;消息数量提示&#xff0c;消息红点提示 属性作用backgroundColor红点背景色smallSize设置红点大小isLabelVisible是否显示offset设置红点位置alignment设置红点位置child设置底部组件 代码块 class Badge…

【Elasticsearch】开源搜索技术的演进与选择:Elasticsearch 与 OpenSearch

开源搜索技术的演进与选择&#xff1a;Elasticsearch 与 OpenSearch 1.历史发展2.OpenSearch 与 Elasticsearch 相同点3.OpenSearch 与 Elasticsearch 不同点3.1 版本大不同3.2 许可证不同3.3 社区不同3.4 功能不同3.5 安全性不同3.6 性能不同3.7 价格不同3.8 两者可相互导入 4…

LLM- 注意力机制

一&#xff1a;什么是注意力机制&#xff0c;以及产生背景&#xff1f; &#xff08;1&#xff09;&#xff1a;RNN模型[RNN模型]的缺点&#xff1a;下图是例如RNN模型解决机器翻译的例子&#xff0c;从这个例子可以看到Encoder最后一个向量&#xff08;eos&#xff09;送给了…

Open3D 从体素网格构建八叉树

目录 一、概述 1.1体素网格 1.2八叉树构建 1.3应用 二、代码实现 2.1关键函数 2.2完整代码 三、实现效果 3.1原始点云 3.2体素网格 3.3八叉树 3.4体素网格 一、概述 八叉树&#xff08;Octree&#xff09;是一种树状数据结构&#xff0c;用于递归地将三维空间划分为…

极客天成RDMA分布式存储加速自动驾驶仿真建模

01 自动驾驶汽车行业发展现状 随着全球5G技术的应用与发展&#xff0c;人工智能产业的逐步推进&#xff0c;无人驾驶汽车行业市场规模显著增长。中商产业研究院发布的《2024-2029全球与中国无人驾驶列车系统市场现状及未来发展趋势》显示&#xff0c;2023年全球无人驾驶汽车行…

AutoMQ 生态集成 Kafdrop-ui

Kafdrop [1] 是一个为 Kafka 设计的简洁、直观且功能强大的Web UI 工具。它允许开发者和管理员轻松地查看和管理 Kafka 集群的关键元数据&#xff0c;包括主题、分区、消费者组以及他们的偏移量等。通过提供一个用户友好的界面&#xff0c;Kafdrop 大大简化了 Kafka 集群的监控…

【Ubuntu】windows和Linux文件互传、共享

【Ubuntu】windows和Linux文件互传、共享 一、FTP、SAMBA、NFS简介 FTP: File Transfer Protocol&#xff08;文件传输协议) SAMBA: 基于SMB(Server Message Block服务器消息块)协议的软件实现 NFS: Network File System&#xff08;网络文件系统&#xff09; 二、Linux 共享文…

QT案例-通过QCustomPlot库绘制Window系统CPU温度实时折线图

之前项目中涉及到了获取硬件信息内容&#xff0c;对CPU的温度监控有点兴趣&#xff0c;观察和百度发现鲁大师和驱动人生的CPU温度监控貌似是用驱动实现的&#xff0c;有点太高大上了&#xff0c;搞不懂。后面经过到处查找资料终于找到了Qt在Windows 环境下监控CPU等硬件温度/运…

android文本长按复制

android文本长按复制 &#x1f4d6;1. 长按直接复制✅步骤一&#xff1a;定义一个TextView✅步骤二&#xff1a;为TextView注册长按事件✅步骤三&#xff1a;弹出系统复制功能 &#x1f4d6;2. 长按弹框确认复制✅步骤一&#xff1a;定义一个TextView✅步骤二&#xff1a;封装P…

vue详解

目录 ​编辑 常用指令 v-for v-bind v-if & v-show v-if v-show v-on v-model Vue生命周期 ​编辑 Axios Axios使用步骤 Axios-请求方式别名 Vue简单案例 常用指令 指令:HTML标签上带有 v-前缀的特殊属性&#xff0c;不同的指令具有不同的含义&#xff0c;可…

2.5 C#视觉程序开发实例1----CamManager实现模拟相机采集图片(Form_Vision部分代码)

2.5 C#视觉程序开发实例1----CamManager实现模拟相机采集图片(Form_Vision部分代码) 1 目标效果视频 CamManager 2 增加一个class IMG_BUFFER 用来管理采集的图片 // <summary> /// IMG_BUFFER 用来管理内存图片的抓取队列 /// </summary> public class IMG_BUFF…

imx6ull/linux应用编程学习(14) MQTT基础知识

什么是mqtt&#xff1f; 与HTTP 协议一样&#xff0c; MQTT 协议也是应用层协议&#xff0c;工作在 TCP/IP 四层模型中的最上层&#xff08;应用层&#xff09;&#xff0c;构建于 TCP/IP协议上。 MQTT 最大优点在于&#xff0c;可以以极少的代码和有限的带宽&#xff0c;为连接…

electron在VSCode和IDEA及webStrom等编辑器控制台打印日志乱码

window10环境下设置 1.打开Windows设置 2.打开时间和语言&#xff0c;选择语言菜单、如何点击管理语言设置 3.打开之后选择管理&#xff0c;选择更改系统区域设置&#xff0c;把Beta版&#xff1a;使用Unicode UTF-8提供全球语言支持 勾上&#xff0c;点击确定&#xff0c;…

后端学习(一)

添加数据库包&#xff1a; 数据库连接时 发生错误&#xff1a; 解决方式&#xff1a; SqlConnection conn new SqlConnection("serverlocalhost;databaseMyBBSDb;uidsa;pwd123456;Encryptfalse;") ;conn.Open();SqlCommand cmd new SqlCommand("SELECT * FROM…