File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
libraries/Bluefruit52Lib/examples/Peripheral/blehid_camerashutter Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,23 @@ BLEHidAdafruit blehid;
2929 uint8_t pinShutter = A0;
3030#endif
3131
32+ // Circuit Play Bluefruit has button active state = high
33+ #ifdef ARDUINO_NRF52840_CIRCUITPLAY
34+ #define BTN_ACTIVE HIGH
35+ #else
36+ #define BTN_ACTIVE LOW
37+ #endif
38+
3239void setup ()
3340{
3441 pinMode (pinShutter, INPUT_PULLUP);
3542
3643 Serial.begin (115200 );
44+
45+ #if CFG_DEBUG
46+ // Blocking wait for connection when debug mode is enabled via IDE
3747 while ( !Serial ) delay (10 ); // for nrf52840 with native usb
48+ #endif
3849
3950 Serial.println (" Bluefruit52 HID Camera Shutter Example" );
4051 Serial.println (" --------------------------------------\n " );
@@ -106,7 +117,7 @@ void startAdv(void)
106117void loop ()
107118{
108119 // Skip if shutter pin is not Ground
109- if ( digitalRead (pinShutter) == 1 ) return ;
120+ if ( digitalRead (pinShutter) != BTN_ACTIVE ) return ;
110121
111122 // Make sure we are connected and bonded/paired
112123 for (uint16_t conn_hdl=0 ; conn_hdl < BLE_MAX_CONNECTION; conn_hdl++)
You can’t perform that action at this time.
0 commit comments