是小车自平衡的代码,是arduino的,// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation // is used in I2Cdev.h #include "Wire.h"` /******************************************************/ //UNO pin map int ENA=9; int ENB=11; int IN1=7; i
MsTime2,霍尔编码器测速
100毫秒触发一次中断,打印出这100毫秒内,霍尔编码器测到的脉冲数。
代码如下:
#include
//TB6612引脚定义
const int right_R1=8;
const int right_R2=12;
const int PWM_R=10;
const int left_L1=7;
const int left_L2=6;
const int PWM_L=9;
const int PinA_left = 5; //定义检测左电机脉冲