2-1 傳統循線車
(ㄧ)雙感測器運作原理
(二)程式
boolean 左 = 數位輸入();
boolean 右 = 數位輸入();
if (左 && !右) {
向右修正;
} else if (右 && !左) {
向左修正;
} else {
前進;
}Last updated
Was this helpful?
boolean 左 = 數位輸入();
boolean 右 = 數位輸入();
if (左 && !右) {
向右修正;
} else if (右 && !左) {
向左修正;
} else {
前進;
}Last updated
Was this helpful?
Was this helpful?