now I've encountered a new problem, I tried hereby make a timer circuit relay pin 7 should be 30 minutes late by 30 minutes of the start over and pin 6 must be on for 18 hours and 6 hours so that both are in a loop? now so it will not work with my code? Regards Tobias
Read the how to use the forum sticky to see how to post code correctly.
This is the wrong section, this is about installation of your arduino system.
Look at the limits on an int and long int, you are using ints in that delay.
Does anyone know any code that has a timer function for the relay as you can control via phone / computer? would be easier to learn if you have a working code that I can build on?
If you are not able to figure out a solution to the relatively simple problem you posed in your first post DON'T make things doubly difficult by including a phone connection.
Get the simple project working first. Then add on to it. That's how professionals do it.
Have you experimented with the Blink Without Delay example?
okay: P is a little anxious maybe: P I checked on the blink example but I did not really understand how it worked with where to put the times and how to get it to go in a loop with multiple relays me various times. Sincerely Tobias
Go through it again until you understand how it works. It's an example of one delay with one counter. If you want a second delay, you just add the code for a second counter. You can add as many as you like. You're trying for very long delays, though, so you might also want to read this: Arduino Playground - Time
Now I have managed to get the relay to turn on for 30 minutes on the 30 min in a loop would do the same thing with relay 2 but it will have times of 18 hours and 6 hours. I have a little difficulty with the translation because it is a bit difficult for me xD best regards Tobias
tobba__1990:
Now I have managed to get the relay to turn on for 30 minutes on the 30 min in a loop would do the same thing with relay 2 but it will have times of 18 hours and 6 hours. I have a little difficulty with the translation because it is a bit difficult for me xD best regards Tobias
Your first sentence seems that it is actually probably two sentences, but I don't know whether to put the full-stop after "30 min" or after "in a loop" (or somewhere else altogether) so it's hard to understand your question.
I'm also not sure whether you mean translation of code or translation of your language to English.
In any case post your most recent code (in code tags!).
sketch_mar11a.ino:2:10: error: #include expects "FILENAME" or
sketch_mar11a:9: error: 'dht' does not name a type
sketch_mar11a.ino: In function 'void loop()':
sketch_mar11a:50: error: 'DHT' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
no it is correct. do not really understand how I add to bibloteket only get error message. how do I do properly? 've read in various places on the tried in various ways.
It would help if you posted your code, but this is probably what you need:
I get the impression that you're coming at this project from zero programming background. I think what would help you most is if you bought a relevant book book, such as the Arduino Cookbook, and worked through it. There's a lot to learn and with this stuff you need to learn to help yourself as far as possible. The questions that you're asking are the sorts of things that are covered in introductory guides.
but wonder what is wrong when I get this error code? for coden to work. is it hard to fix? the only thing left on this project. if someone can write step by step how I do it is simple to fix. thanks in advance
sketch_mar11a:11: error: 'dht' does not name a type
sketch_mar11a.ino: In function 'void loop()':
sketch_mar11a:107: error: 'DHT' was not declared in this scope
sketch_mar11a:110: error: 'DHTLIB_OK' was not declared in this scope
sketch_mar11a:113: error: 'DHTLIB_ERROR_CHECKSUM' was not declared in this scope
sketch_mar11a:116: error: 'DHTLIB_ERROR_TIMEOUT' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
but wonder what is wrong when I get this error code?
The program cannot find the library file. Either you have not used #include properly, the library was not installed properly or you did not stop/restart the IDE after installing the library.
yes it is instalerat but do not think it was right?
#include <LiquidCrystal.h>
#include <dht.h>
/*******************************************************
This program will test the LCD panel, the buttons
and the Humidity/Temperature sensor
Version : 0.1
Date : 20-Oct-2013
By Hardkernel
********************************************************/
// for Digital Humidity and Temperature sensor (DHT11)
dht DHT;
#define DHT11_PIN 3
// Global variables
unsigned long elapsed_time;
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
// read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741
// we add approx 50 to those values and check to see if we are close
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
return btnNONE; // when all others fail, return this...
}
void setup()
{
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
lcd.begin(16, 2); // start the LCD library
lcd.setCursor(0,0);
lcd.print(" Hello, ODUINO! "); // print a simple message
// 1234567890123456
delay(1500); // Splash for 1.5 second
Serial.println("ODUINO TEST PROGRAM ");
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
elapsed_time = millis()/1000; // Returns the number of milliseconds since the Arduino board began running the current program.
}
void loop()
{
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print("KEY :");
lcd.setCursor(6,1); // move to the begining of the second line
lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key) // depending on which button was pushed, we perform an action
{
case btnRIGHT:
{
lcd.print("RIGHT ");
Serial.println("RIGHT ");
break;
}
case btnLEFT:
{
lcd.print("LEFT ");
Serial.println("LEFT ");
break;
}
case btnUP:
{
lcd.print("UP ");
Serial.println("UP ");
break;
}
case btnDOWN:
{
lcd.print("DOWN ");
Serial.println("DOWN ");
break;
}
case btnSELECT:
{
lcd.print("SELECT");
Serial.println("SELECT ");
break;
}
case btnNONE:
{
lcd.print("NONE ");
break;
}
}
// Read & Display the humidity / temperature data every 1 second (approx.)
if(elapsed_time != millis()/1000)
{
elapsed_time = millis()/1000;
Serial.print("DHT11, \t");
int chk = DHT.read11(DHT11_PIN);
switch (chk)
{
case DHTLIB_OK:
Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity,0);
Serial.print(",\t");
Serial.println(DHT.temperature,0);
lcd.setCursor(0,0); // move cursor to second line "1" and 9 spaces over
lcd.print("HUMI:");
lcd.print((int)(DHT.humidity));
lcd.print("%");
lcd.print(" TEM:");
lcd.print((int)(DHT.temperature));
lcd.print("C");
}
delay(50); // delay 50 msec.
}