fakeBeacon / button.h /
Yanik Cawidrone Parameter tweak again
246e027 5 years ago
1 contributor
48 lines | 1.244kb
#ifndef _BUTTON_H
#define _BUTTON_H

#include "beacon.h"

int buttonState = 0;         // variable for reading the pushbutton status
const int BUTTON_PRG = 0;     // PRG Button
const int ledPin =  13;      // the number of the LED pin

void pollPrg() 
{ 
  buttonState = digitalRead(BUTTON_PRG);
  if (buttonState == LOW) {
    Serial.println("pollPrg: Call");
    switch( beacon_type ) {
    case EN_BEACON_TYPE_entry:
      beacon_type = EN_BEACON_TYPE_hazard;
      beaconTypeStr="Hazard   ";
      break;
    case EN_BEACON_TYPE_hazard:
      beacon_type = EN_BEACON_TYPE_safe;
      beaconTypeStr="Safe     ";
      break;
    case EN_BEACON_TYPE_safe:
      beacon_type = EN_BEACON_TYPE_exit;
      beaconTypeStr="Exit     ";
      break;
    case EN_BEACON_TYPE_exit:
      beacon_type = EN_BEACON_TYPE_other;
      beaconTypeStr="Other    ";
      break;
    case EN_BEACON_TYPE_other:
      beacon_type = EN_BEACON_TYPE_entry;
      beaconTypeStr="Entry    ";
      break;
    default:
      beacon_type = EN_BEACON_TYPE_safe;
      beaconTypeStr="Safe     ";
      break;
    }
    Serial.println("Switching to "+beaconTypeStr);
  }
  DisplayButtonStatus();
}

#endif //_BUTTON_H