Created
January 8, 2020 10:36
-
-
Save deviceplususer/61337933985e41e906923422e9a923d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int motorSpeed = analogRead(MOTOR_SPEED);//速度調整つまみの値を取得 | |
if ( motorSpeed > 10 )//つまみの値が一定以上なら | |
{ | |
motorSpeed = map( motorSpeed, 10, 1023, 40, 255 );//つまみの値をスピードに変換 | |
motor1.drive( motorSpeed );//指定したスピードでモーターを回す | |
} else { | |
motor1. brake();//つまみの値が一定以下ならモーターを止める | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment