之前学习了超声波测距,然后学习了点亮数码管,此例使用数码管显示测得的距离
//4位8段共阴数码管引脚图
//1 a f 2 3 b
//e d dp c g 4
//abcdefg. 分别是8段引脚
int a = 9;
int b =13;
int c = A2;
int d = A4;
i ...
之前学了RGB灯,今天学了超声波测距,于是想将两者结合,简单将之前发的两段代码融合如下
int TrgPin = A0;
int EcoPin = A1;
int sw = 5;
int red = 4;
int blue = 3;
int green = 2;
float dist;
void setup()
...