file:///C:/Users/Administrator/Desktop/IMG_20210707_103514.jpg重新发一下
代码
volatile float mind_n_INPUT;
// 主程序开始
void setup() {
Serial.begin(9600);
}
void loop() {
mind_n_INPUT = pulseIn(A3, HIGH, 86400000000);
Serial.println(mind_n_INPUT);
if ((mind_n_INPUT>1515)) {
analogWrite(5, 0);
analogWrite(11, 0);
delay(1);
analogWrite(3, (map(mind_n_INPUT, 1515, 1775, 0, 255)));
analogWrite(6, (map(mind_n_INPUT, 1515, 1775, 0, 255)));
}
if ((1485>mind_n_INPUT)) {
analogWrite(3, 0);
analogWrite(6, 0);
delay(1);
analogWrite(5, (map(mind_n_INPUT, 1485, 1250, 0, 153)));
analogWrite(11, (map(mind_n_INPUT, 1485, 1250, 0, 153)));
}
if (((1515>mind_n_INPUT) && (mind_n_INPUT>1485))) {
analogWrite(5, 0);
analogWrite(11, 0);
analogWrite(3, 0);
analogWrite(6, 0);
delay(5);
}
}
|