Example #1
0
void Motor::setup()
{
   Pin* pin = Esp8266::getInstance()->getPin(directionPinId);
   if (pin)
   {
      pin->setMode(OUTPUT);
   }

   pin = Esp8266::getInstance()->getPin(speedPinId);
   if (pin)
   {
      pin->setMode(OUTPUT);
   }
}
VibrationSensor2::VibrationSensor2(
    const String& id,
    const int& pinId) : Component(id)
{
    this->pinId = pinId;
    serverId = "";
    sensitivity = DEFAULT_SENSITIVITY;
    responsiveness= DEFAULT_RESPONSIVENESS;

    vibrationCount = 0;

    for (int i = 0; i < NUM_INTERVALS; i++)
    {
        queue[i] = NOT_VIBRATING;
    }

    Pin* pin = Esp8266::getInstance()->getPin(pinId);
    if (pin)
    {
        pin->setMode(INPUT);
    }

    stateChangeTime = millis();
}