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

news2024/12/28 6:02:32

本项目算是接触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

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

小车循迹演示

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

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

相关文章

PDA:Prompt-based Distribution Alignment for Unsupervised Domain Adaptation

文章汇总 式中&#xff0c; y s y^s ys表示源域数据的one-hot ground-truth&#xff0c; K K K为类数&#xff0c; w i w_i wi​和 z ~ s \tilde{z}_s z~s​分别表示源域经过提示调优的最终文本表示和最终图像表示的第 i i i类。 同理&#xff0c;为了进一步利用目标领域的数据…

多用户挂售转卖竞拍闪拍商城系统/NFT数藏系统/后端PHP+前端UNIAPP源码带教程(亲测源码)

挂售转卖竞拍商城系统源码/竞拍系统/转拍闪拍系统/后端PHP前端UNiapp源码 亲测可用 1、后台管理&#xff1a;系统管理员通过后台可以轻松添加商品进行挂单。这包括商品的详细信息&#xff0c;如名称、描述、价格、库存等。 商品展示&#xff1a;挂单后的商品会在商城前端进行…

Mysql笔记-v2【7月8日更新】

零、 help、\h、? 调出帮助 mysql> \hFor information about MySQL products and services, visit:http://www.mysql.com/ For developer information, including the MySQL Reference Manual, visit:http://dev.mysql.com/ To buy MySQL Enterprise support, training, …

概论(二)随机变量

1.名词解释 1.1 样本空间 一次具体实验中所有可能出现的结果&#xff0c;构成一个样本空间。 1.2 随机变量 把结果抽象成数值&#xff0c;结果和数值的对应关系就形成了随机变量X。例如把抛一次硬币的结果&#xff0c;正面记为1&#xff0c;反面记为0。有变量相对应的就有自…

MySQL高级----InnoDB引擎

逻辑存储结构 表空间 表空间(ibd文件)&#xff0c;一个mysql实例可以对应多个表空间&#xff0c;用于存储记录、索引等数据。 段 段&#xff0c;分为数据段&#xff08;Leaf node segment)、索引段(Non-leaf node segment)、回滚段(Rollback segment)&#xff0c;InnoDB是…

DETR目标检测框架

概念&#xff1a;DETR&#xff08;Detection Transformer&#xff09;是一种基于Transformer架构的端到端目标检测框架。它与传统的基于区域提议的目标检测方法有所不同。传统方法通常依赖于手工设计的组件&#xff08;如锚框、非极大值抑制等&#xff09;&#xff0c;而DETR将…

设计模式7-装饰模式

设计模式7-装饰模式 写在前面动机模式定义结构代码推导原始代码解决问题分析 选择装饰模式的理由1. 职责分离&#xff08;Single Responsibility Principle&#xff09;2. 动态扩展功能3. 避免类爆炸4. 开闭原则&#xff08;Open/Closed Principle&#xff09;5. 更好的组合复用…

【数据结构】11.快速排序

一、快速排序的思想 快速排序是Hoare于1962年提出的一种二叉树结构的交换排序方法&#xff0c;其基本思想为&#xff1a;任取待排序元素序列中的某元素作为基准值&#xff0c;按照该排序码将待排序集合分割成两子序列&#xff0c;左子序列中所有元素均小于基准值&#xff0c;右…

深度解密Spark性能优化之道课程

课程通过实战案例解析和性能调优技巧的讲解&#xff0c;帮助学员提升大数据处理系统的性能和效率。课程内容涵盖了Spark性能调优的各个方面&#xff0c;包括内存管理、并行度设置、数据倾斜处理、Shuffle调优、资源配置等关键技术和策略。学员将通过实际案例的演示和分析&#…

【云原生】Kubernetes部署EFK日志分析系统

Kubernetes部署EFK日志分析系统 文章目录 Kubernetes部署EFK日志分析系统一、前置知识点1.1、k8s集群应该采集哪些日志&#xff1f;1.2、k8s比较流行的日志收集解决方案1.3、fluentd、filebeta、logstash对比分析1.3.1、Logstash1.3.2、Filebeat1.3.3、fluentd 1.4、EFK工作原理…

设计模式探索:观察者模式

1. 观察者模式 1.1 什么是观察者模式 观察者模式用于建立一种对象与对象之间的依赖关系&#xff0c;当一个对象发生改变时将自动通知其他对象&#xff0c;其他对象会相应地作出反应。 在观察者模式中有如下角色&#xff1a; Subject&#xff08;抽象主题/被观察者&#xf…

【数据结构】12.排序

一、排序的概念及其运用 1.1排序的概念 排序&#xff1a;所谓排序&#xff0c;就是使一串记录&#xff0c;按照其中的某个或某些关键字的大小&#xff0c;递增或递减的排列起来的操作。 稳定性&#xff1a;假定在待排序的记录序列中&#xff0c;存在多个具有相同的关键字的记…

(自适应手机端)保健品健康产品网站模板下载

(自适应手机端)保健品健康产品网站模板下载PbootCMS内核开发的网站模板&#xff0c;该模板适用于装修公司网站、装潢公司网站等企业&#xff0c;当然其他行业也可以做&#xff0c;只需要把文字图片换成其他行业的即可&#xff1b;自适应手机端&#xff0c;同一个后台&#xff0…

sql盲注

文章目录 布尔盲注时间盲注 布尔盲注 介绍&#xff1a;在网页只给你两种回显的时候是用&#xff0c;类似于布尔类型的数据&#xff0c;1表示正确&#xff0c;0表示错误。 特点&#xff1a;思路简单&#xff0c;步骤繁琐且麻烦。 核心函数&#xff1a; length()函数substr()函…

ZD屏幕录像机解锁版下载及安装教程 (一款小巧的轻量级屏幕录像工具)

录屏系列软件安装目录 一、超好用的傲软录屏下载和解锁版安装教程 (专业好用的桌面录屏软件)&#xff09; 二、班迪录屏Bandicam v7解锁版安装教程&#xff08;高清录屏软件&#xff09; 三、Mirillis Action v4 解锁版安装教程(专业高清屏幕录像软件) 四、Aiseesoft Scree…

C语言编程3:运算符,运算符的基本用法

C语言3&#x1f525;&#xff1a;运算符&#xff0c;运算符的基本用法 一、运算符&#x1f33f; &#x1f387;1.1 定义 运算符是指进行运算的动作&#xff0c;比如加法运算符"“&#xff0c;减法运算符”-" 算子是指参与运算的值&#xff0c;这个值可能是常数&a…

Apache Spark分布式计算框架架构介绍

目录 一、概述 二、Apache Spark架构组件栈 2.1 概述 2.2 架构图 2.3 架构分层组件说明 2.3.1 支持数据源 2.3.2 调度运行模式 2.3.3 Spark Core核心 2.3.3.1 基础设施 2.3.3.2 存储系统 2.3.3.3 调度系统 2.3.3.4 计算引擎 2.3.4 生态组件 2.3.4.1 Spark SQL 2.…

三菱PLC 实现PID控制温度 手搓PID指令!!!

目录 1.前言 2.PID公式的讲解 3.程序 4.硬件介绍 5.EPLAN图纸 6.成果展示 7.结语 1.前言 新手想要学习PLC的PID控制 首先会被大串的PID 公式吓到 PID公式有很多种&#xff1a;基本PID 位置式 增量式 模拟式 理想型 等等 但是 不要急 别看这么多公式 其实 将公式拆…

如何通过ip地址判断网络类别

在计算机网络中&#xff0c;IP地址不仅是设备在网络中的唯一标识&#xff0c;同时也隐含了网络类别的信息。了解如何根据IP地址判断网络类别&#xff0c;对于网络管理员、系统工程师以及网络爱好者来说都是一项基本技能。本文将详细介绍如何通过IP地址判断网络类别。 一、IP地址…

普中51单片机:矩阵按键扫描与应用详解(五)

文章目录 引言电路图开发板IO连接矩阵键盘的工作原理行列扫描逐行/逐列扫描 LCD1602代码库代码演示——暴力扫描代码演示——数码管(行列式)代码演示——线翻转法代码演示——LCD1602密码锁 引言 矩阵按键是一种通过行列交叉连接的按键阵列&#xff0c;可以有效地减少单片机I/…