When trying to make a function that would activate the built in LED on the arduino, I ran into an error.
The LED would only activate if the humidity sensor detected an amount greater than 95. Right now this is a prototype for a future project. The project will activate a pump motor instead of an LED. The pump will fuel a Hydroponics system that will be self sustained.
#include <SimpleDHT.h>
int pinDHT11 = 2;
SimpleDHT11 dht11;
void setup() {
//set built in LED as an output
pinMODE (LED_BUILTIN, OUTPUT); //Pinmode that says it's not declared in scope
}
void loop() {
// tests temperature and humidity
byte temperature = 0;
byte humidity = 0;
byte data[40] = {0};
if (humidity > 95) { // If the humidity is greater than 95 it activates the LED
digitalWrite(LED_BUILTIN, HIGH);
}
return ;
if (humidity < 95) { //If the humidity is below 95 then led is turned off
digitalWrite(LED_BUILTIN,LOW);
}
return ;
delay(1000);
}
#include <SimpleDHT.h>
int pinDHT11 = 2;
SimpleDHT11 dht11;
void setup() {
//set built in LED as an output
pinMODE (LED_BUILTIN, OUTPUT);
}
void loop() {
// tests temperature and humidity
byte temperature = 0;
byte humidity = 0;
byte data[40] = {0};
if (humidity > 95) { // If the humidity is greater than 95 it activates the LED
digitalWrite(LED_BUILTIN, HIGH);
}
return ;
if (humidity < 95) { //If the humidity is below 95 then led is turned off
digitalWrite(LED_BUILTIN,LOW);
}
return ;
delay(1000);
}
anyway, if you run the script it just gives you a pinMODE not declared in scope error.