不知哪地方有问题 求助 最后俩段无法运行
if (sensorType !=1) return;a= value0; // value0 = X sensor reading
b= value1;// value1 = Y sensor reading
u=abs(a);
k=abs(b);
b=constrain(b,0,10);
analogWrite(Pin1, b*22.5);
a=constrain(a,0,10); // Map Accelerometer Y value to tilt servo angle.
analogWrite(Pin1, a*22.5);
if(a<=0){
a=constrain(a,-10,0); // Map Accelerometer Y value to tilt servo angle.
analogWrite(Pin2,u*22.5);
}
if(b<=0){
b=constrain(b,-10,0); // Map Accelerometer Y value to tilt servo angle.
analogWrite(Pin2,k*22.5);
}
}
页:
[1]