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;
29
29
uint8_t pinShutter = A0;
30
30
#endif
31
31
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
+
32
39
void setup ()
33
40
{
34
41
pinMode (pinShutter, INPUT_PULLUP);
35
42
36
43
Serial.begin (115200 );
44
+
45
+ #if CFG_DEBUG
46
+ // Blocking wait for connection when debug mode is enabled via IDE
37
47
while ( !Serial ) delay (10 ); // for nrf52840 with native usb
48
+ #endif
38
49
39
50
Serial.println (" Bluefruit52 HID Camera Shutter Example" );
40
51
Serial.println (" --------------------------------------\n " );
@@ -106,7 +117,7 @@ void startAdv(void)
106
117
void loop ()
107
118
{
108
119
// Skip if shutter pin is not Ground
109
- if ( digitalRead (pinShutter) == 1 ) return ;
120
+ if ( digitalRead (pinShutter) != BTN_ACTIVE ) return ;
110
121
111
122
// Make sure we are connected and bonded/paired
112
123
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