Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在、pygame lib、python、raspberryPI、および adafruit motor hat を使用してロボットをプログラミングしています。以下は、モーターの速度を 0 から 100 に上げるための例です。
for i in range(100): motor.run(i)
このコードは、前後に移動するための定義内にあり、キーボード ボタンが押されたときに使用されます。ただし、キーが離されたときに「for」ループを中断したいと考えています。
あなたは実際に「休憩」という言葉で頭に解決策を打ちました:
for i in range(100): motor.run(i) if ...: #key is released break