Motor/GPIO (Simulating Motor With LEDs)#
Meetings/News#
2025-06-17: Group 2: libgpiod Fiasco
Goal#
Create a Motor implementation, MotorLED, that does not rreally
drive a motor. Rather it uses two LEDs - forward and
backward - that are used as indicators for the motor driving
direction. Both off means “motor idle”. The LEDs are driven using
libgpiod.
How#
class MotorLED : public Motor
{
public:
MotorLED(const std::string& gpiodevice, int line_number_forward, int line_number_backward);
...
};
gpiodeviceis for example/dev/gpiochip0line_number_forwardandline_number_backwardare the numbers of the respective GPIO line (see for example the Raspberry Pi pinout diagram)
Use the libgpiod library to implement the forward(),
backward(), and stop() methods.
Testing#
Real hardware cannot be tested using unit tests (at least not
easily). Write a test program (in tests/) that uses MotorLED
to manipulate the LED states.