コメント
This commit is contained in:
parent
8dbdddaaea
commit
a9ba272657
1 changed files with 6 additions and 6 deletions
|
@ -159,9 +159,9 @@ int checkMarker(byte sensor){
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void motorMode(byte motorLeftMode, byte motorRightMode, byte motorLeftSpeed, byte motorRightSpeed){
|
void motorMode(byte leftMode, byte rightMode, byte leftSpeed, byte rightSpeed){
|
||||||
motorL.mode( motorLeftMode, motorLeftSpeed);
|
motorL.mode( leftMode, leftSpeed);
|
||||||
motorR.mode(motorRightMode, motorRightSpeed);
|
motorR.mode(rightMode, rightSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle(int degree){
|
void handle(int degree){
|
||||||
|
@ -197,7 +197,7 @@ void sensorInit(){
|
||||||
}
|
}
|
||||||
|
|
||||||
byte sensorRead(){
|
byte sensorRead(){
|
||||||
byte sensor = 0;
|
byte sensor = 0; //黒が1、白が0
|
||||||
if(digitalRead(PIN_SENSOR_0)) sensor += 0b00000001;
|
if(digitalRead(PIN_SENSOR_0)) sensor += 0b00000001;
|
||||||
if(digitalRead(PIN_SENSOR_1)) sensor += 0b00000010;
|
if(digitalRead(PIN_SENSOR_1)) sensor += 0b00000010;
|
||||||
if(digitalRead(PIN_SENSOR_2)) sensor += 0b00000100;
|
if(digitalRead(PIN_SENSOR_2)) sensor += 0b00000100;
|
||||||
|
@ -239,10 +239,10 @@ void setup() {
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
/* センサーを見る */
|
/* センサーを見る */
|
||||||
byte sensor = 0;
|
byte sensor = 0; //ラインが1、地面が0
|
||||||
#ifdef LINE_BLACK //黒ライン
|
#ifdef LINE_BLACK //黒ライン
|
||||||
sensor = sensorRead();
|
sensor = sensorRead();
|
||||||
#else
|
#else //白ライン
|
||||||
sensor = ~sensorRead();
|
sensor = ~sensorRead();
|
||||||
#endif
|
#endif
|
||||||
count(); //ロータリーエンコーダーの変化を見る
|
count(); //ロータリーエンコーダーの変化を見る
|
||||||
|
|
Loading…
Add table
Reference in a new issue