scripts samen gevoegd en overal comments geplaatst
This commit is contained in:
39
arduino/sensor combo/combi/combi.ino
Normal file
39
arduino/sensor combo/combi/combi.ino
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
//de library van de tempratuur en vochtisheid sensor er bij pakken.
|
||||||
|
#include <DHT11.h>
|
||||||
|
|
||||||
|
// LDR = 12, geeft gaan dat het variable LDR terugwijst naar 12.
|
||||||
|
#define LDR 12
|
||||||
|
|
||||||
|
//tegen DHT11 library zeggen dat we het variabel TLV willen geven en dat het de informatie van pin 18 kan halen.
|
||||||
|
DHT11 TLV(18);
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
//hoeveel bits er per seconden worden gestuurd naar de pc, moet je ook instellen in arduino IDE anders krijg je gibberish terug in je serial monitor.
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
//int geeft aan dat het een geheeld nummer moet zijn, als je float gebruikt kan het ook nog decimalen hebben
|
||||||
|
// eerste 2 zijn van DHT om data van af te lezen en op te slaan in het variabel
|
||||||
|
//laatste is om de lichtsensor analoog af te lezen en op te slaan in een variabel
|
||||||
|
int hoomid = TLV.readHumidity();
|
||||||
|
int temp = TLV.readTemperature();
|
||||||
|
int analogValue = analogRead(LDR);
|
||||||
|
|
||||||
|
//hier worden alle variabelen in de serial monitor uitgespuugt
|
||||||
|
Serial.println("----------");
|
||||||
|
|
||||||
|
Serial.print("temparatuur celcius: ");
|
||||||
|
Serial.println(temp);
|
||||||
|
|
||||||
|
Serial.print("vochtigheid: ");
|
||||||
|
Serial.println(hoomid);
|
||||||
|
|
||||||
|
Serial.print("LDR reading: ");
|
||||||
|
Serial.println(analogValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
delay(2000);
|
||||||
|
}
|
Reference in New Issue
Block a user