PyRasp
Try itPracticeDocsBlogYour first circuit
Sign in

← All practice problems

Raspberry Pi Pico practice problem · Raspberry Pi Pico

Forward and reverse

HardBudget $26MicroPython

A motor on IN1 GP20, IN2 GP21, ENA GP22, with buttons GP12 (forward) and GP13 (reverse).

Press forward: IN1 high, IN2 low. Press reverse: IN1 low, IN2 high. ENA stays high. Debounce the buttons; the last press wins.

Solve it free

More in Raspberry Pi Pico

  • Easy The Pico’s own LED Blink the LED built into the board, on GP25.
  • Easy First blink Blink an LED once a second, forever.
  • Easy Traffic light Red, green, amber — a traffic light on three LEDs.
  • Easy Button mirror The LED follows the button: on while it is held, off while it is not.
  • Medium Press to toggle Each press flips the LED — and the contacts bounce, so debounce it.
  • Medium PWM fade Fade an LED up with PWM, one step every 0.2 s.