Class Lock

Class Documentation

class BlackBox::Lock

Class for controling lock.

Public Functions

~Lock() = default
Lock(gpio_num_t motor = Pins::Lock::Motor, gpio_num_t encoderA = Pins::Lock::A, gpio_num_t encoderB = Pins::Lock::B, ledc_timer_t timer = LEDC_TIMER_0, ledc_channel_t channel = LEDC_CHANNEL_0)

Construct a new Lock object.

Parameters
  • motor – pin on which motor is connected

  • encoderA – pin on which encoder is connected

  • encoderB – pin on which encoder is connected

  • timer – number of timer to use (for compability with other applications)

  • channel – number of LEDC channel to use (for compability with other applications)

void init()

Initialize lock.

void lock()

Lock lock.

void unlock()

Unlock lock.

bool locked()

Whether or not the lock is locked.

Returns true

- locked

Returns false

- unlocked