diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/hid_camerashutter/hid_camerashutter.ino b/libraries/Bluefruit52Lib/examples/Peripheral/hid_camerashutter/hid_camerashutter.ino index 39aff0ac..d44b267a 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/hid_camerashutter/hid_camerashutter.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/hid_camerashutter/hid_camerashutter.ino @@ -14,21 +14,26 @@ /* * This sketch uses the HID Consumer Key API to send the Volume Down - * key when PIN_SHUTTER is grounded. This will cause your mobile device + * key when pinShutter is grounded. This will cause your mobile device * to capture a photo when you are in the camera app. * - * For Feather nRF52840 PIN_SHUTTER is conveniently user switch. + * For Feather nRF52840 pinShutter is conveniently user switch. */ #include BLEDis bledis; BLEHidAdafruit blehid; -#define PIN_SHUTTER 7 +// Use on-board button if available, else use A0 pin +#ifdef PIN_BUTTON1 + uint8_t pinShutter = PIN_BUTTON1; +#else + uint8_t pinShutter = A0; +#endif void setup() { - pinMode(PIN_SHUTTER, INPUT_PULLUP); + pinMode(pinShutter, INPUT_PULLUP); Serial.begin(115200); while ( !Serial ) delay(10); // for nrf52840 with native usb @@ -41,7 +46,7 @@ void setup() Serial.println("then open the camera application"); Serial.println(); - Serial.printf("Set pin %d to GND to capture a photo\n", PIN_SHUTTER); + Serial.printf("Set pin %d to GND to capture a photo\n", pinShutter); Serial.println(); Bluefruit.begin(); @@ -104,7 +109,7 @@ void startAdv(void) void loop() { // Skip if shutter pin is not Ground - if ( digitalRead(PIN_SHUTTER) == 1 ) return; + if ( digitalRead(pinShutter) == 1 ) return; // Make sure we are connected and bonded/paired for (uint16_t conn_hdl=0; conn_hdl < BLE_MAX_CONNECTION; conn_hdl++) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/nrf_blinky/nrf_blinky.ino b/libraries/Bluefruit52Lib/examples/Peripheral/nrf_blinky/nrf_blinky.ino index 70886e52..00c1805a 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/nrf_blinky/nrf_blinky.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/nrf_blinky/nrf_blinky.ino @@ -62,9 +62,9 @@ BLECharacteristic lsbLED(LBS_UUID_CHR_LED); // Use on-board button if available, else use A0 pin #ifdef PIN_BUTTON1 -uint8_t button = PIN_BUTTON1; + uint8_t button = PIN_BUTTON1; #else -uint8_t button = A0; + uint8_t button = A0; #endif uint8_t buttonState;