Skip to content

Commit 2bd2250

Browse files
committed
Add Full Code Sections
1 parent 8dd3def commit 2bd2250

File tree

5 files changed

+80
-5
lines changed

5 files changed

+80
-5
lines changed

content/hardware/08.kits/maker/iot-bundle/tutorials/i-love-you-pillow/content.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,63 @@ This tutorial is part of a series of experiments that familiarize you with the A
284284
* [Puzzle Box with Arduino IoT Bundle](/tutorials/iot-bundle/puzzlebox)
285285
* [Pavlov's Cat with the Arduino IoT Bundle](/tutorials/iot-bundle/pavlovs-cat)
286286
* [Plant Communicator with the Arduino IoT Bundle](/tutorials/iot-bundle/plant-communicator)
287-
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
287+
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
288+
289+
## Full Code
290+
291+
```arduino
292+
#include "thingProperties.h"
293+
int Buzzer = 8;
294+
void setup() {
295+
// Initialize serial and wait for port to open:
296+
Serial.begin(9600);
297+
delay(1500);
298+
// Defined in thingProperties.h
299+
initProperties();
300+
// Connect to Arduino IoT Cloud
301+
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
302+
setDebugMessageLevel(2);
303+
ArduinoCloud.printDebugInfo();
304+
}
305+
void loop() {
306+
ArduinoCloud.update();
307+
if (chat ==
308+
"
309+
<3
310+
"
311+
) {
312+
chat = "\U00002764";
313+
}
314+
315+
int reading = analogRead(A0);
316+
317+
//threshold set to 500, this can be adjusted to your liking
318+
if(reading > 500){
319+
pressed = true;
320+
321+
//execute the activateBuzzer() function when threshold is being met.
322+
activateBuzzer();
323+
heart_beat +=1; //increase heart_beat value for every "heart beat".
324+
}
325+
else{
326+
pressed = false;
327+
}
328+
}
329+
void activateBuzzer() {
330+
tone(Buzzer, 31, 200); // tone(Pin, Note, Duration);
331+
delay(200);
332+
tone(Buzzer, 31, 400);
333+
delay(200);
334+
noTone(Buzzer);
335+
delay(1000);
336+
}
337+
void onChatChange() {
338+
//this function is automatically generated
339+
}
340+
void onHeartBeatChange() {
341+
//this function is automatically generated
342+
}
343+
void onPressedChange() {
344+
//this function is automatically generated
345+
}
346+
```

content/hardware/08.kits/maker/iot-bundle/tutorials/pavlovs-cat/content.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,4 +569,8 @@ This tutorial is part of a series of experiments that familiarize you with the A
569569
* [I Love You Pillow with the Arduino IoT Bundle ](/tutorials/iot-bundle/i-love-you-pillow)
570570
* [Puzzle Box with Arduino IoT Bundle ](/tutorials/iot-bundle/puzzlebox)
571571
* [Plant Communicator with the Arduino IoT Bundle ](/tutorials/iot-bundle/plant-communicator)
572-
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
572+
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
573+
574+
## Full Code
575+
576+
<iframe src=https://create.arduino.cc/editor/Arduino_Genuino/9d4af26d-4a07-4523-9f34-2642e85fb3a9/preview?embed style="height:510px;width:100%;margin:10px 0" frameborder=0></iframe>

content/hardware/08.kits/maker/iot-bundle/tutorials/plant-communicator/content.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,8 @@ This tutorial is part of a series of experiments that familiarize you with the A
244244
* [I Love You Pillow with the Arduino IoT Bundle ](/tutorials/iot-bundle/i-love-you-pillow)
245245
* [Puzzle Box with Arduino IoT Bundle ](/tutorials/iot-bundle/puzzlebox)
246246
* [Plant Communicator with the Arduino IoT Bundle ](/tutorials/iot-bundle/plant-communicator)
247-
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
247+
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
248+
249+
## Full Code
250+
251+
<iframe src=https://create.arduino.cc/editor/Arduino_Genuino/8f464fc9-2bf5-488b-8ffa-540991bf9da3/preview?embed style="height:510px;width:100%;margin:10px 0" frameborder=0></iframe>

content/hardware/08.kits/maker/iot-bundle/tutorials/puzzlebox/content.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,4 +1115,8 @@ This tutorial is part of a series of experiments that familiarize you with the A
11151115
* [I Love You Pillow with the Arduino IoT Bundle](/tutorials/iot-bundle/i-love-you-pillow)
11161116
* [Pavlov's Cat with the Arduino IoT Bundle](/tutorials/iot-bundle/pavlovs-cat)
11171117
* [Plant Communicator with the Arduino IoT Bundle](/tutorials/iot-bundle/plant-communicator)
1118-
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
1118+
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
1119+
1120+
## Full Code
1121+
1122+
<iframe src=https://create.arduino.cc/editor/Arduino_Genuino/77796ee5-af44-422c-99a8-fde653a8a51b/preview?embed style="height:510px;width:100%;margin:10px 0" frameborder=0></iframe>

content/hardware/08.kits/maker/iot-bundle/tutorials/the-nerd/content.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,8 @@ This tutorial is part of a series of experiments that familiarize you with the A
142142
* [I Love You Pillow with the Arduino IoT Bundle ](/tutorials/iot-bundle/i-love-you-pillow)
143143
* [Puzzle Box with Arduino IoT Bundle ](/tutorials/iot-bundle/puzzlebox)
144144
* [Plant Communicator with the Arduino IoT Bundle ](/tutorials/iot-bundle/plant-communicator)
145-
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
145+
* [The Nerd with the Arduino IoT Bundle](/tutorials/iot-bundle/the-nerd)
146+
147+
## Full Code
148+
149+
<iframe src=https://create.arduino.cc/editor/Arduino_Genuino/68fecf75-d394-4063-8082-8a5a21226ce3/preview?embed style="height:510px;width:100%;margin:10px 0" frameborder=0></iframe>

0 commit comments

Comments
 (0)