File tree 1 file changed +6
-7
lines changed
examples/TemperatureAlert 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 4
4
Nano 33 BLE Sense. If the temperature increases above a certain limit, it turns the buzzer on.
5
5
The circuit:
6
6
- Arduino Nano 33 BLE Sense
7
- - Active buzzer module connected at pin 9
7
+ - Active buzzer module connected to pin 9 and GND
8
8
9
9
written by K.Abhijeet
10
10
This example code is in the public domain
11
11
*/
12
12
13
13
#include < Arduino_HTS221.h>
14
14
15
- float tempLimit = 37 ; // set your temperature limit in °C
15
+ float tempLimit = 37 ; // set your temperature limit in °C
16
16
17
17
void setup () {
18
18
Serial.begin (9600 );
@@ -28,13 +28,13 @@ void setup() {
28
28
29
29
void loop () {
30
30
31
- float temperature = HTS.readTemperature (); // read the sensor value
31
+ float temperature = HTS.readTemperature (); // read the sensor value
32
32
33
- Serial.print (" Temperature = " ); // print the sensor value
33
+ Serial.print (" Temperature = " ); // print the sensor value
34
34
Serial.print (temperature);
35
35
Serial.println (" °C" );
36
36
37
- if (temperature > tempLimit)
37
+ if (temperature > tempLimit)
38
38
{
39
39
digitalWrite (9 , HIGH);
40
40
delay (500 );
@@ -43,7 +43,6 @@ void loop() {
43
43
}
44
44
else
45
45
{
46
- delay (2000 ); // wait a while before displaying the next reading If the temperature is below the limit
46
+ delay (2000 ); // wait a while before displaying the next reading If the temperature is below the limit
47
47
}
48
-
49
48
}
You can’t perform that action at this time.
0 commit comments