Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: program stops when using a timer function on: December 24, 2013, 07:14:23 am
This is the whole code.
Excuse me but I'm not a programmer, so I think the code can be optimize a lot.
Inputs are all pushbuttons.
Outputs are a mix between Relays for 230 Vac, Fet's for 12 Vdc.
To have more outputs I used DMX controllers.
Here is still some work to do. The DMX controller blocks the serial monitor for the moment.

2  Using Arduino / Programming Questions / Re: program stops when using a timer function on: December 23, 2013, 06:24:34 pm
I modified my code  I hope it would work.

void afsluiten()
 // alle lichten worden gedoofd, uitgezonderd HALL
// All light OFF excepts the light in the hall that goes on for 5 minutes
   starttijd=millis(); // aanpassing 23/11/2013
  digitalWrite(Relay_1,RELAY_OFF); state1=0; state1b=0;
  digitalWrite(Relay_2,RELAY_OFF); state2=0; state2b=0;
  digitalWrite(Relay_3,RELAY_OFF); state3=0; state3b=0;
  digitalWrite(Relay_4,RELAY_OFF); state4=0;
  digitalWrite(Relay_5,RELAY_OFF); state5=0;
  digitalWrite(Relay_6,RELAY_OFF); state6=0;
  digitalWrite(Relay_7,RELAY_OFF); state7=0;
  digitalWrite(Relay_8,RELAY_OFF); state8=0;
  digitalWrite(Relay_9,RELAY_ON); state9=1;//  Hall    aanpassing 23/11/2013
  digitalWrite(Relay_10,RELAY_OFF); state10=0;state9b=0;
  digitalWrite(Relay_11,RELAY_OFF); state11=0;state11b=0;
  digitalWrite(Relay_12,RELAY_OFF); state12=0;
  digitalWrite(Relay_13,RELAY_OFF); state13=0;
  digitalWrite(Relay_14,RELAY_OFF); state14=0;
  digitalWrite(Relay_15,RELAY_OFF); state15=0;
  //digitalWrite(Relay_16,RELAY_OFF); state16=0; //doorgang
  for (int i=0;i<=7;i++)
    ArduinoDmx0.TxBuffer = 0; // alle dmx-kanalen uitzetten

void tijdrelais()
// verlichting blijft 5 minuten nabranden.
// light in the Hall goes OUT after 5 minutes
    if (millis() - starttijd > 5L * 60 * 1000)
    { digitalWrite(Relay_9,RELAY_OFF); state9 =0;

I will upload the sketch tomorrow

MAS3, inderdaad mijn programma is in het nederlands geschreven. Waarschijnlijk niet zo slim van mij.

3  Using Arduino / Programming Questions / Re: program stops when using a timer function on: December 23, 2013, 06:05:45 pm
Thanks a lot.
I wil modify my sketch with this information.
4  Using Arduino / Programming Questions / Re: program stops when using a timer function on: December 23, 2013, 05:42:14 pm
The problem is that during the 5 minutes that the timer is active, I cannot put some light back ON again. When I push another button, the arduino gives no reaction anymore during that time.
5  Using Arduino / Programming Questions / program stops when using a timer function on: December 23, 2013, 05:00:38 pm
I made a small home control system.
One of the functions is that when I push one button, all the outputs are set LOW (all lights out), expect one output ( light in the hall) that goes HIGH during 5 minutes, so that I can leave the house on a safe way.
This function works good, except that during the time that the timer of 5 minutes is active, the arduino refuses all the other actions.
I use this subroutine for the timer function :

void tijdrelais()
// light HALL goes on for 5 minutes to lease the house
   while(millis() < starttijd+300000)
   { digitalWrite(Relay_9,RELAY_ON); state9 =1;
     digitalWrite(Relay_9,RELAY_OFF); state9 =0;

I specially used the millis() function in case of the the delay function to avoid that the arduino should be blocked during the timer function.

6  Using Arduino / Programming Questions / Re: 'clickbutton' library on: September 09, 2013, 12:28:15 pm
thanks a lot
7  Using Arduino / Programming Questions / 'clickbutton' library on: September 08, 2013, 05:11:46 pm
I'm writng a sketch to control a LED. Therefore I will use the clickbutton library.

Functions :
A short click has to toggle the LED (on/off)
A long click has to reduce the brightness of the LED.
The on/off works fine, but I have problems with reducing the brightness.
From the moment I give a long puls, the output go immediatly to his minimum position (50)

my sketch :
/* ClickButton library test

    Single click - Toggle LED on/off
    Long clicks (hold button for one second or longer): reduce brightness
  The circuit:
  - LED  pin 13
  - pushbutton attached from pin 4 to GND, no pullup resistor


#include "ClickButton.h"

// the LED
const int ledPin = 13;
int ledState = 0;

// the Button
const int buttonPin1 = 4;
ClickButton button1(buttonPin1, LOW, CLICKBTN_PULLUP);

// Arbitrary LED function
int LEDfunction = 0;

void setup()
  // Setup button timers (all in milliseconds / ms)
  // (These are default if not set, but changeable for convenience)
  button1.debounceTime   = 10;   // Debounce timer in ms
  button1.multiclickTime = 250;  // Time limit for multi clicks
  button1.longClickTime  = 1000; // time until "held-down clicks" register

void loop()
  // Update button state

  // Save click codes in LEDfunction, as click codes are reset at next Update()
  if (button1.clicks != 0) LEDfunction = button1.clicks;

  // Simply toggle LED on single clicks
  if(button1.clicks == 1){
      if (ledState > 5) ledState = 0;
      else ledState = 250;
// Long click, reduce brightness
if(LEDfunction == -1 and ledState >50) {ledState = ledState - 50;
//delay (1000);

  // update the LED
8  Topics / Home Automation and Networked Objects / Re: modifying library on: June 01, 2013, 02:09:27 pm
Modification done with notepad++ and it works fine
9  Topics / Home Automation and Networked Objects / Re: modifying library on: June 01, 2013, 12:31:36 pm
I think the problem is the way I save the libary.
I used wordpad and I think the file looses his original settings.
Can someone explain me how I have to save the .h and .cpp files ?
10  Topics / Home Automation and Networked Objects / Re: modifying library on: May 30, 2013, 03:28:05 pm
I made a new library subdir with the new .h and .cpp in it.
11  Topics / Home Automation and Networked Objects / Re: Arduino domotics - house under construction on: May 27, 2013, 03:52:10 pm
Why not connecting the different arduinos with a RS485-bus and the master arduino connected with a ethernet shield to the internet.
12  Topics / Home Automation and Networked Objects / Re: My 1st Home Automation system on: May 27, 2013, 03:46:27 pm
Very nice done
13  Topics / Home Automation and Networked Objects / modifying library on: May 27, 2013, 03:44:25 pm
For my Diy home project I will use the library TKButton for TinkerKit to operate the pushbuttons. I had to modify the library because the TKbutton is written for pushbuttons connected to the + 5V. In my hardware the buttons are connected to the ground. Also for the output I use negativ logics.
I modified the TinkerKit ( .cpp an .h)with wordpad and gave them also another name (TinkerNKit). Now my arduino sketch will not accept the new name and give faults during compiling.
14  Using Arduino / Project Guidance / Re: charge controller electric storage heaters on: March 25, 2013, 06:18:14 pm
the hardware is not a problem. I know how to connect the in- and output on a save way.
The challenge is writing the software for the arduino
15  Using Arduino / Project Guidance / charge controller electric storage heaters on: March 25, 2013, 04:54:05 pm
I have a heating system with electric storage heaters. The storage heaters are charged during the night with cheep electricity.
The charge controller itself is already old and has a mechanical clock and I 'm afraid he will be end of life one of those days.
For that reason I will start a project with a arduino to replace the controller.

What is the charge controller doing :
1. measuring the outside temperature every 30 minutes and calculating the average temperature of the last 24 hours.
2. calculating the necessary charge for the next day (depending of the average day temperature of the last 24 hours)
3. Calculating the charge time.
4. calculating the starttime of the charging so that the storage heaters has accumulate enough heat when the night electricity go off.

Hardware I want to use :
arduino uno
arduino hardware clock
some output relais

The night electricity comes on around 11pm and stays on for 7 hours every night.

Is it possible to do this project with a arduino.
For me it should be a big challenge because I have not much experience in programming with arduino. Hope I will find here on the forum some help.

Pages: [1] 2