13
13
*********************************************************************/
14
14
15
15
/*
16
- * Sketch use HID Consumer Key API to send Volume Down key when
17
- * PIN_SHUTTER is grounded. Which cause mobile to capture photo
18
- * when you are in Camera App
16
+ * This sketch uses the HID Consumer Key API to send the Volume Down
17
+ * key when PIN_SHUTTER is grounded. This will cause your mobile device
18
+ * to capture a photo when you are in Camera App
19
19
*/
20
20
#include < bluefruit.h>
21
21
@@ -35,10 +35,10 @@ void setup()
35
35
36
36
Serial.println ();
37
37
Serial.println (" Go to your phone's Bluetooth settings to pair your device" );
38
- Serial.println (" then open an Camera application" );
38
+ Serial.println (" then open the camera application" );
39
39
40
40
Serial.println ();
41
- Serial.printf (" Wire your Pin %d to GND to capture picture \n " , PIN_SHUTTER);
41
+ Serial.printf (" Set pin %d to GND to capture a photo \n " , PIN_SHUTTER);
42
42
Serial.println ();
43
43
44
44
Bluefruit.begin ();
@@ -50,11 +50,12 @@ void setup()
50
50
bledis.begin ();
51
51
52
52
/* Start BLE HID
53
- * Note: Apple requires BLE device must have min connection interval >= 20m
54
- * ( The smaller the connection interval the faster we could send data).
55
- * However for HID and MIDI device, Apple could accept min connection interval
56
- * up to 11.25 ms. Therefore BLEHidAdafruit::begin() will try to set the min and max
57
- * connection interval to 11.25 ms and 15 ms respectively for best performance.
53
+ * Note: Apple requires BLE devices to have a min connection interval >= 20m
54
+ * (The smaller the connection interval the faster we can send data).
55
+ * However for HID and MIDI device, Apple will accept a min connection interval
56
+ * as low as 11.25 ms. Therefore BLEHidAdafruit::begin() will try to set
57
+ * the min and max connection interval to 11.25 ms and 15 ms respectively
58
+ * for the best performance.
58
59
*/
59
60
blehid.begin ();
60
61
@@ -87,31 +88,30 @@ void setupAdv(void)
87
88
88
89
void loop ()
89
90
{
90
- // Connected and Bonded/Paired
91
+ // Make sure you are connected and bonded/paired
91
92
if ( Bluefruit.connected () && Bluefruit.connPaired () )
92
93
{
93
- // Pin is wired to GND
94
+ // Check if pin GND'ed
94
95
if ( digitalRead (PIN_SHUTTER) == 0 )
95
96
{
96
- // Turn on LED Red when start sending
97
+ // Turn on red LED when we start sending data
97
98
digitalWrite (LED_RED, 1 );
98
99
99
- // Send Volumn Down key press
100
- // Check BLEHidGerneric.h for list of defined consumer usage code
100
+ // Send the 'volume down' key press
101
+ // Check BLEHidGerneric.h for list of defined consumer usage codes
101
102
blehid.consumerKeyPress (HID_USAGE_CONSUMER_VOLUME_DECREMENT);
102
103
103
- // Delay a bit between repots
104
+ // Delay a bit between reports
104
105
delay (10 );
105
106
106
107
// Send key release
107
108
blehid.consumerKeyRelease ();
108
109
109
- // Turn off LED Red
110
+ // Turn off the red LED
110
111
digitalWrite (LED_RED, 0 );
111
112
112
113
// Delay to avoid constant capturing
113
114
delay (500 );
114
115
}
115
116
}
116
117
}
117
-
0 commit comments