Bram documentation updated
This commit is contained in:
@@ -101,12 +101,16 @@ I wanted to make my own spin on the original design by including a button to act
|
|||||||
The rest of the tutorial was clear and worked like a charm.
|
The rest of the tutorial was clear and worked like a charm.
|
||||||
the code used looks like this:
|
the code used looks like this:
|
||||||
|
|
||||||
|
Begin by including a specific library for the DHT11.
|
||||||
```
|
```
|
||||||
#include "DHT.h"
|
#include "DHT.h"
|
||||||
#define DHTPIN 4
|
#define DHTPIN 4
|
||||||
#define DHTTYPE DHT11
|
#define DHTTYPE DHT11
|
||||||
DHT dht(DHTPIN, DHTTYPE);
|
DHT dht(DHTPIN, DHTTYPE);
|
||||||
|
```
|
||||||
|
using This perticulair serial port, means that you do have to switch to it when you want to see results coming in.
|
||||||
|
The dht.begin command starts the process.
|
||||||
|
```
|
||||||
void setup() {
|
void setup() {
|
||||||
//the serial port:
|
//the serial port:
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
@@ -116,7 +120,11 @@ Serial.println(F("DHTxx test!"));
|
|||||||
//the library start
|
//the library start
|
||||||
dht.begin();
|
dht.begin();
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
It starts by making float variables, to give over the information.
|
||||||
|
It also includes a error message in case of no feedback.
|
||||||
|
|
||||||
|
```
|
||||||
void loop() {
|
void loop() {
|
||||||
delay(2000);
|
delay(2000);
|
||||||
//a float has decimal numbers and the library reads the measurements.
|
//a float has decimal numbers and the library reads the measurements.
|
||||||
@@ -134,7 +142,7 @@ void loop() {
|
|||||||
float hif = dht.computeHeatIndex(f, h);
|
float hif = dht.computeHeatIndex(f, h);
|
||||||
float hic = dht.computeHeatIndex(t, h, false);
|
float hic = dht.computeHeatIndex(t, h, false);
|
||||||
|
|
||||||
//all serial.ptint's send stuff to the serial board to showcase.
|
//all serial.print's send stuff to the serial board to showcase.
|
||||||
Serial.print(F("Humidity: "));
|
Serial.print(F("Humidity: "));
|
||||||
Serial.print(h);
|
Serial.print(h);
|
||||||
Serial.print(F("% Temperature: "));
|
Serial.print(F("% Temperature: "));
|
||||||
@@ -186,7 +194,7 @@ pinMode(buzzerone, OUTPUT);
|
|||||||
pinMode(buzzertwo, OUTPUT);
|
pinMode(buzzertwo, OUTPUT);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Here the button pin will seek a signal, when it is given it will send signals to the other given pins in he if-statement.
|
Here the button pin will seek a signal, when it is given it will send signals to the other given pins in the if-statement.
|
||||||
```
|
```
|
||||||
void loop() {
|
void loop() {
|
||||||
//read is there is input on the button pin, if so send output to the other pins, otherwise keep them off.
|
//read is there is input on the button pin, if so send output to the other pins, otherwise keep them off.
|
||||||
|
Reference in New Issue
Block a user