Compare commits

..

2 Commits

  1. 4
      Sensors/platformio.ini
  2. 37
      Sensors/src/main.cpp
  3. 6
      blink/src/main.cpp

4
Sensors/platformio.ini

@ -12,3 +12,7 @@
platform = atmelavr
board = uno
framework = arduino
lib_deps =
# RECOMMENDED
# Accept new functionality in a backwards compatible manner and patches
adafruit/DHT sensor library @ ^1.4.6

37
Sensors/src/main.cpp

@ -2,10 +2,47 @@
#include <Arduino.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
// #include <DHT_U.h>
#define DHTTYPE DHT11
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE);
float humidity;
float tempC;
float tempF;
int setTime = 500;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("DHT11 test!");
dht.begin();
delay(setTime);
}
void loop() {
// put your main code here, to run repeatedly:
humidity = dht.readHumidity();
tempC = dht.readTemperature();
tempF = dht.readTemperature(true);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" Temperature: ");
Serial.print(tempC);
Serial.print(" *C ");
Serial.print(tempF);
Serial.println(" *F");
delay(setTime * 2);
}

6
blink/src/main.cpp

@ -10,6 +10,8 @@ void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
Serial.println("Hello World");
}
void loop()
@ -17,9 +19,9 @@ void loop()
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(1000);
delay(100);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(1000);
delay(100);
}

Loading…
Cancel
Save