Show Posts
|
|
Pages: [1] 2
|
|
1
|
Using Arduino / Programming Questions / Re: Need help with sketch- 2nd try
|
on: October 03, 2012, 04:36:15 am
|
|
Quote This sketch prints temperature and humidity in serial monitor OK. Quote from AWOL I very, very much doubt that.
You have done nothing to help. Now you call me a liar.I have rewritten the code using others input and thought to repost a fresh sketch and not to make the other post 10 pages. personally I don't think you know how to write crap if you can't figure what I am trying to do. Maybe you should put the bottle up!
|
|
|
|
|
2
|
Using Arduino / Programming Questions / Need help with DHT11 skrtch 3rd try
|
on: October 03, 2012, 03:54:54 am
|
|
This sketch prints temperature and humidity in serial monitor OK. I am not sure if I am using the right code to read the outputs of temp/humidity to turn on and off the LED’s. If the temperature falls below 60 degrees turn on ledpin8 and if above 80 degrees turn of ledpin8. Right now my room temp is 77 degrees, when I run the program ledpin8 goes high then low in one click it does not stay high till 80 degrees. Humidity(ledpin9) just goes high then low in less than a second. I just want to turn on ledpin8 when the temperature is below 60 degrees and turn off ledpin8 when the temperature reaches 80 degrees.This is only my second sketch...noobie Thanks
#include <dht11.h>
dht11 DHT11;
void setup() {const int LEDPIN8 = 8; // Temp const int LEDPIN9 = 9; // Humidity pinMode (LEDPIN8, OUTPUT); // Temp pinMode (LEDPIN9, OUTPUT); // Humidity const int THRESHOLD1 = 60; // Temp lower limit turn on const int THRESHOLD3 = 80; // Temp upper limit turn off const int THRESHOLD2 = 50; // humidity lower limit turn on const int THRESHOLD4 = 75; // humidity upper limit turn off float Temperature; float Humidity;
DHT11.attach(2); Serial.begin(9600); }
void loop() { const int LEDPIN8 = 8; // Temp const int LEDPIN9 = 9; // Humidity pinMode (LEDPIN8, OUTPUT); // Temp pinMode (LEDPIN9, OUTPUT); // Humidity const int THRESHOLD1 = 60; // Temp lower limit turn on const int THRESHOLD3 = 80; // Temp upper limit turn off const int THRESHOLD2 = 50; // humidity lower limit turn on const int THRESHOLD4 = 75; // humidity upper limit turn off float Temperature; float Humidity;
Serial.println("\n");
int chk = DHT11.read();
Serial.print("Read sensor: "); switch (chk) { case 0: Serial.println("OK"); break; case -1: Serial.println("Checksum error"); break; case -2: Serial.println("Time out error"); break; default: Serial.println("Unknown error"); break; }
Serial.print("Humidity (%): "); Serial.println((float)DHT11.humidity, DEC);
Serial.print("Temperature (F): "); Serial.println(DHT11.fahrenheit(), DEC); //Temperature Temperature = (DHT11.fahrenheit(), DEC); if (DHT11.fahrenheit(), DEC < THRESHOLD1) // temp turn on led...less than 60 degrees digitalWrite(LEDPIN8, HIGH); if (DHT11.fahrenheit(), DEC > THRESHOLD3) // temp turn off led.. more than 80 degrees digitalWrite(LEDPIN8,LOW); //Humidity Humidity = (DHT11.humidity, DEC); if (DHT11.humidity, DEC < THRESHOLD2) // Humidity turn on led than 50 percent digitalWrite(LEDPIN9, HIGH);
if (DHT11.humidity, DEC > THRESHOLD4) // Humidity turn off led.. more than 75 percent digitalWrite(LEDPIN9,LOW);
delay(200); }
|
|
|
|
|
3
|
Using Arduino / Programming Questions / Re: Need help with sketch- 2nd try
|
on: October 03, 2012, 01:52:26 am
|
|
What do you expect this Code:
if (DHT11.fahrenheit(), DEC < THRESHOLD1)
to do? If the temp is lower than 60 turn on Ledpin6 Looks like my pinmodes are in setup The sketch compiles and displays temp/humidity, just won't hold the Led's high between thresholds
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Re: Need help with sketch- 2nd try
|
on: October 03, 2012, 12:33:15 am
|
When I set the (temp) threshold1 to 60 ( lower limit), which is below my room temp and threshold3 to 80(upper limit), Ledpin8 just flashes once and goes low, never comes on again, unless restart. I wonder if my IF statements are right? At least a LED comes on. The prog prints temp/humidity OK #include <dht11.h>
dht11 DHT11;
void setup() { DHT11.attach(2); Serial.begin(9600); }
void loop() { const int LEDPIN8 = 8; // Temp const int LEDPIN9 = 9; // Humidity pinMode (LEDPIN8, OUTPUT); // Temp pinMode (LEDPIN9, OUTPUT); // Humidity const int THRESHOLD1 = 60; // Temp lower limit turn on..60 const int THRESHOLD3 = 100; // Temp upper limit turn off const int THRESHOLD2 = 50; // humidity lower limit turn on const int THRESHOLD4 = 75; // humidity upper limit turn off float Temperature; float Humidity;
Serial.println("\n");
int chk = DHT11.read();
Serial.print("Read sensor: "); switch (chk) { case 0: Serial.println("OK"); break; case -1: Serial.println("Checksum error"); break; case -2: Serial.println("Time out error"); break; default: Serial.println("Unknown error"); break; }
Serial.print("Humidity (%): "); Serial.println((float)DHT11.humidity, DEC);
Serial.print("Temperature (F): "); Serial.println(DHT11.fahrenheit(), DEC); //Temperature Temperature = (DHT11.fahrenheit(), DEC); if (DHT11.fahrenheit(), DEC < THRESHOLD1) // temp turn on...less than 60 digitalWrite(LEDPIN8, HIGH); //delay(4000);//works on temp if (DHT11.fahrenheit(), DEC > THRESHOLD3) // temp turn off.. more than 80 digitalWrite(LEDPIN8,LOW); //Humidity Humidity = (DHT11.humidity, DEC); if (DHT11.humidity, DEC < THRESHOLD2) // Humidity turn on les than 50 digitalWrite(LEDPIN9, HIGH); //delay(2000);//no work on hum
if (DHT11.humidity, DEC > THRESHOLD4) // Humidity turn off.. more than 75 digitalWrite(LEDPIN9,LOW);
delay(200); }
Moderator edit: CODE TAGS
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Need help with sketch- 2nd try
|
on: October 02, 2012, 08:34:16 pm
|
|
Using a DHT11 on arduino1280, Trying to turn on LED when threshold met When I compile it stops on Temperature = (Temperature (°F): ); and says stray "/" in program, I can't find it Sorry don't understand code tags yet, don't see #
#include <dht11.h>
dht11 DHT11;
void setup() { DHT11.attach(2); Serial.begin(9600); }
void loop() { const int LEDPIN8 = 8; // Temp const int LEDPIN9 = 9; // Humidity pinMode (LEDPIN8, OUTPUT); // Temp pinMode (LEDPIN9, OUTPUT); // Humidity {const int THRESHOLD1 = 80; // Temp const int THRESHOLD2 = 50; // humidity Temperature = (Temperature (°F): );
Serial.println("\n");
int chk = DHT11.read();
Serial.print("Read sensor: "); switch (chk) { case 0: Serial.println("OK"); break; case -1: Serial.println("Checksum error"); break; case -2: Serial.println("Time out error"); break; default: Serial.println("Unknown error"); break; }
Serial.print("Humidity (%): "); Serial.println((float)DHT11.humidity, DEC);
Serial.print("Temperature (°F): "); Serial.println(DHT11.fahrenheit(), DEC); //Temperature Temperature = (DHT11.fahrenheit(), DEC); if (Temperature < THRESHOLD1) // heat digitalWrite(LEDPIN8, HIGH); else digitalWrite(LEDPIN8,LOW); else digitalWrite(LEDPIN8,LOW); //Humidity Humidity = (float)DHT11.humidity, DEC); if (Humidity > THRESHOLD2) // Humidity digitalWrite(LEDPIN9, HIGH);
else digitalWrite(LEDPIN9,LOW);
delay(20000); }
|
|
|
|
|
7
|
Using Arduino / Programming Questions / Need help with sketch
|
on: October 02, 2012, 03:47:41 pm
|
|
Howdy I’m a beginner I am trying to use a DHT11 to monitor temp/humidity ( turn on Led8 when temp drops below threshold1 and use threshold2 for humidity-not entered yet, if I can figure temp first then humid. I have declared threshold1, but keep getting this error when compiling Threshold1 was not declared in this scope Using arduino 1280 and arduino 1.01 Thanks for all replies
#include <dht11.h>
dht11 DHT11;
void setup() { const int LEDPIN8 = 8; // heat const int LEDPIN9 = 9;// mister pinMode (LEDPIN8, OUTPUT); // Heat
pinMode (LEDPIN9, OUTPUT); // Mister DHT11.attach(2); Serial.begin(9600);
const int THRESHOLD1 = 90; // Heat const int THRESHOLD2 = 90; // Mister
}
void loop() { Serial.println("\n");
int chk = DHT11.read();
Serial.print("Read sensor: "); switch (chk) { case 0: Serial.println("OK"); break; case -1: Serial.println("Checksum error"); break; case -2: Serial.println("Time out error"); break; default: Serial.println("Unknown error"); }
Serial.print("Temperature (°F): "); Serial.println(DHT11.fahrenheit(), DEC); if (chk < THRESHOLD1) // digitalWrite(LEDPIN8, HIGH);
else digitalWrite(LEDPIN8,LOW);
delay(20000); }
|
|
|
|
|
8
|
Using Arduino / Programming Questions / Re: Anybody using Visual Studio pro 2010 with Arduino?
|
on: August 26, 2012, 01:07:35 am
|
I have built this simple cloud charge monitor http://www.techlib.com/electronics/cloud.htmI have it hooked up to an arduino uno with 9 LED’s that light up as the charge progressive, works good with a comb run thru your hair and over the pan. We are in a drought right now, so I am waiting for a real T-storm for the real test. The arduino powers the circuit and will run off the laptop, so no fear of lightning coming in from the wall. I have serial print set up in the arduino code and can read it in serial monitor, I just need to figure the code in VB to get the data into a text box, then I can work on gauges and graphs. I am using com 2 default settings. If you have a short program in VB to do that and would share it, it would be much appreciated. Just a hump to get over Thanks
|
|
|
|
|
13
|
Using Arduino / Programming Questions / Which software to interface to computer
|
on: August 18, 2012, 02:08:58 pm
|
|
Howdy I am new to arduino. I have written my first sketch to read the analog 0 port and turn on several LED’s. I would like to know which programming software is the easiest way to send the info to the computer to print on the screen ( VB-6, C++,VB-2010. Etc.). Right now all I want to do, is print the values from analog in. I have Visual basic-6 Thanks for any help
|
|
|
|
|