Show Posts
Pages: 1 ... 12 13 [14] 15 16 ... 20
196  Using Arduino / Project Guidance / Re: heating control on: July 06, 2012, 09:56:09 am
correct me if im wrong the timing circuits there i just need to put a command in to pull it low at the end.  i have been playing with it for a little while and still having the same issues.
197  Using Arduino / Project Guidance / Re: altering an output over a period of time on: July 05, 2012, 03:33:55 pm
bit port

basically what im trying to do is have a o-10v output i know i can only get a 0-5v out of the arduino but i will have to figure something to convert to when i get there.
198  Using Arduino / Project Guidance / altering an output over a period of time on: July 05, 2012, 01:35:38 pm
hi there
im trying to make an output that goes from 0 to 255 (or vise versa) over a period of time such as 20 mins ?
and ideas or example would be helpful
thanks Joe
199  Using Arduino / Project Guidance / Re: heating control on: July 04, 2012, 03:00:23 pm
i have played with putting things in there until ive gone blue in the face but i only seem to be able to get the fan to run continously or no delay or just cutting out randomly

p.s the only bit thats been copied and pasted in is your bit and being dyslexic makes it even harder as i dont even understand general english!
200  Using Arduino / Project Guidance / Re: heating control on: July 03, 2012, 04:10:02 pm
yes thats what i was planning for

still not working lol mite have left something tho

Code:
#define THIRTY_SECONDS 30000

const int heatbutton     = 2 ;
const int ignition_fan_2 = 10;
const int saleswitch     = 4 ;
const int solenoid       = 12;
const int photo_pressure = 3 ;
const int lockoutled     = 8 ;
const int heatbutton_feed= 5 ;
const int fan            = 9 ;
const int relay230_24    = 11;
const int ionisation_in  = 7 ;
int ionisation           = 5 ;   
bool DoneInitialization = false;       

void setup()
{
  pinMode(heatbutton,       INPUT );   
  pinMode(ignition_fan_2,   OUTPUT);
  pinMode(saleswitch,       INPUT );
  pinMode(solenoid,         OUTPUT);
  pinMode(photo_pressure,   INPUT );
  pinMode(lockoutled,       OUTPUT);
  pinMode(heatbutton_feed,  OUTPUT);
  pinMode(fan,              OUTPUT);
  pinMode(relay230_24,      OUTPUT);
  pinMode(ionisation_in,    INPUT );
  //-------------------------------------------
  digitalWrite(heatbutton_feed, HIGH);
}

void loop() {
    int val = analogRead(ionisation);
   
  static unsigned long startTime;
  static int lastState = HIGH;
  int currentState = digitalRead(heatbutton);
  unsigned long now = millis();
  unsigned long switchHIGHTime = 0;
  unsigned long fanTurnOnTime;
 
  if (now - fanTurnOnTime > switchHIGHTime)
    // Turn the fan off
   
  if (currentState == HIGH) {  // Code goes here to occur whenver the button is HIGH
  delay(10);    //debounce
    if (!DoneInitialization)
    {                                                 
      if (digitalRead(ionisation_in)==   HIGH) {           // if ionisation swith HIGH
        if (val >900) {                                       
          digitalWrite(lockoutled,            HIGH);
         delay(10);
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }   
      else {
        if (digitalRead(photo_pressure)==     HIGH) {         // if photo swith HIGH
        delay(10);
          digitalWrite(lockoutled,            HIGH);
         delay(10);         
          digitalWrite(heatbutton_feed,       LOW);
         return;
       }
      }
      digitalWrite(fan,                    HIGH);
      delay(3000);       
     
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==HIGH) {           // sale switch if HIGH
    digitalWrite(relay230_24,    HIGH);        // 230V out put to ignition
    digitalWrite(ignition_fan_2, HIGH);
    delay(1000);
      digitalWrite(solenoid,     HIGH);
    }
    DoneInitialization=true;                           // Initialization is done, don't run it again until button has been low
    }
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==   LOW) {          // sale switch if LOW
      digitalWrite(lockoutled,      HIGH);
      digitalWrite(solenoid,        LOW);
      digitalWrite(fan,             LOW);
       delay(10);
      digitalWrite(heatbutton_feed, LOW);
    }
    //---------------------------------------------------------------------
    delay(3000);
    if (digitalRead(ionisation_in)== HIGH) {
      if (val <900)                         {            // ionisation if LOW
        digitalWrite(lockoutled,     HIGH);
        delay(10);
        digitalWrite(heatbutton_feed, LOW);
      }
    }

    if (digitalRead(photo_pressure)==LOW)  {          // photo if LOW
      delay(10);
      digitalWrite(lockoutled,       HIGH);
      delay(10);
      digitalWrite(heatbutton_feed,  LOW);
    }
    //---------------------------------------------------------------------
    else {
      digitalWrite(ignition_fan_2, LOW);
    }
    if (lastState == LOW) {
      startTime = now; // Time when the switch went to HIGH
    }
  } else {                      // Code goes here to occur whenver the button is LOW
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                    // resetting the count
    delay(1000);
    digitalWrite(relay230_24,    LOW);
 
    if (lastState == HIGH) {
      switchHIGHTime = now - startTime; // determine how long it was HIGH for
      if (switchHIGHTime > THIRTY_SECONDS)
        switchHIGHTime = THIRTY_SECONDS;
     
      fanTurnOnTime = now;
      switchHIGHTime = THIRTY_SECONDS; // set to 30 seconds if it was on that long
      // Turn the fan on here
    }
  }
  lastState = currentState;
  }
201  Using Arduino / Project Guidance / Re: heating control on: July 02, 2012, 03:43:16 pm
still not working?

Code:


const int heatbutton     = 2 ;
const int ignition_fan_2 = 10;
const int saleswitch     = 4 ;
const int solenoid       = 12;
const int photo_pressure = 3 ;
const int lockoutled     = 8 ;
const int heatbutton_feed= 5 ;
const int fan            = 9 ;
const int relay230_24    = 11;
const int ionisation_in  = 7 ;
int ionisation           = 5 ;   
bool DoneInitialization = false;       
// Variables will change:
int HeatButtonState = LOW;      // HeatButtonState used to set the fan
long previousMillis = 0;        // will store last time fan was updated
long interval = 20000;          // dleay time
void setup()
{
  pinMode(heatbutton,       INPUT );   
  pinMode(ignition_fan_2,   OUTPUT);
  pinMode(saleswitch,       INPUT );
  pinMode(solenoid,         OUTPUT);
  pinMode(photo_pressure,   INPUT );
  pinMode(lockoutled,       OUTPUT);
  pinMode(heatbutton_feed,  OUTPUT);
  pinMode(fan,              OUTPUT);
  pinMode(relay230_24,      OUTPUT);
  pinMode(ionisation_in,    INPUT );
  //-------------------------------------------
  digitalWrite(heatbutton_feed, HIGH);
}

void loop() {
  int val = analogRead(ionisation);
  int lastButtoncurrent = HIGH;
  int currentButtoncurrent = digitalRead(heatbutton);
  //--------------------------------------------------------------------

  if (digitalRead(heatbutton)==               HIGH) {
    delay(10);    //debounce
    if (!DoneInitialization)
    {                                                 
      if (digitalRead(ionisation_in)==        HIGH) {         // if ionisation swith HIGH
        if (val >900) {                                       
          digitalWrite(lockoutled,            HIGH);
          delay(10);
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }   
      else {
        if (digitalRead(photo_pressure)==     HIGH) {         // if photo swith HIGH
          delay(10);
          digitalWrite(lockoutled,            HIGH);
          delay(10);         
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }
      digitalWrite(fan,                        HIGH);
      delay(3000);       

      //---------------------------------------------------------------------
      if (digitalRead(saleswitch)==HIGH) {        // sale switch if HIGH
        digitalWrite(relay230_24,    HIGH);       // 230V out put to ignition
        digitalWrite(ignition_fan_2, HIGH);
        delay(1000);
        digitalWrite(solenoid,     HIGH);
      }
      DoneInitialization=true;                   // Initialization is done, don't run it again until button has been low
    }
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==   LOW) {          // sale switch if LOW
      digitalWrite(lockoutled,      HIGH);
      digitalWrite(solenoid,        LOW);
      digitalWrite(fan,             LOW);
      delay(10);
      digitalWrite(heatbutton_feed, LOW);
    }
    //---------------------------------------------------------------------
    delay(3000);
    if (digitalRead(ionisation_in)== HIGH) {
      if (val <900)                         {         // ionisation if LOW
        digitalWrite(lockoutled,      HIGH);
        delay(10);
        digitalWrite(heatbutton_feed, LOW);
      }
    }

    if (digitalRead(photo_pressure)==LOW)  {          // photo if LOW
      delay(10);
      digitalWrite(lockoutled,       HIGH);
      delay(10);
      digitalWrite(heatbutton_feed,  LOW);
    }
    //---------------------------------------------------------------------
    else {
      digitalWrite(ignition_fan_2, LOW);
    }
  }
  //---------------------------------------------------------------------
  else {                                      // switching off
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                 // resetting the count
    delay(1000);
    digitalWrite(relay230_24,    LOW);
  }
  if (lastButtoncurrent == HIGH) {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      previousMillis = currentMillis;   

      if (HeatButtonState == HIGH)
        HeatButtonState = LOW;

      digitalWrite(fan, HeatButtonState);
    }
   lastButtoncurrent = currentButtoncurrent;
  }

  //---------------------------------------------------------------------

}


202  Using Arduino / Project Guidance / Re: heating control on: July 02, 2012, 01:18:31 pm
any ideas?
203  Using Arduino / Project Guidance / Re: heating control on: June 23, 2012, 09:31:22 am
dont no what i have dun this time lol but still having the same prob?


Code:


const int heatbutton     = 2 ;
const int ignition_fan_2 = 10;
const int saleswitch     = 4 ;
const int solenoid       = 12;
const int photo_pressure = 3 ;
const int lockoutled     = 8 ;
const int heatbutton_feed= 5 ;
const int fan            = 9 ;
const int relay230_24    = 11;
const int ionisation_in  = 7 ;
int ionisation           = 5 ;   
bool DoneInitialization = false;       
// Variables will change:
int HeatButtonState = LOW;      // HeatButtonState used to set the fan
long previousMillis = 0;        // will store last time fan was updated
long interval = 20000;          // dleay time
void setup()
{
  pinMode(heatbutton,       INPUT );   
  pinMode(ignition_fan_2,   OUTPUT);
  pinMode(saleswitch,       INPUT );
  pinMode(solenoid,         OUTPUT);
  pinMode(photo_pressure,   INPUT );
  pinMode(lockoutled,       OUTPUT);
  pinMode(heatbutton_feed,  OUTPUT);
  pinMode(fan,              OUTPUT);
  pinMode(relay230_24,      OUTPUT);
  pinMode(ionisation_in,    INPUT );
  //-------------------------------------------
  digitalWrite(heatbutton_feed, HIGH);
}

void loop() {
  int val = analogRead(ionisation);
  int lastHeatButtonState = HIGH;
  int currentHeatButtonState = digitalRead(heatbutton);
  //--------------------------------------------------------------------

  if (digitalRead(heatbutton)==               HIGH) {
    delay(10);    //debounce
    if (!DoneInitialization)
    {                                                 
      if (digitalRead(ionisation_in)==        HIGH) {         // if ionisation swith HIGH
        if (val >900) {                                       
          digitalWrite(lockoutled,            HIGH);
          delay(10);
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }   
      else {
        if (digitalRead(photo_pressure)==     HIGH) {         // if photo swith HIGH
          delay(10);
          digitalWrite(lockoutled,            HIGH);
          delay(10);         
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }
      digitalWrite(fan,                        HIGH);
      delay(3000);       

      //---------------------------------------------------------------------
      if (digitalRead(saleswitch)==HIGH) {        // sale switch if HIGH
        digitalWrite(relay230_24,    HIGH);       // 230V out put to ignition
        digitalWrite(ignition_fan_2, HIGH);
        delay(1000);
        digitalWrite(solenoid,     HIGH);
      }
      DoneInitialization=true;                   // Initialization is done, don't run it again until button has been low
    }
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==   LOW) {          // sale switch if LOW
      digitalWrite(lockoutled,      HIGH);
      digitalWrite(solenoid,        LOW);
      digitalWrite(fan,             LOW);
      delay(10);
      digitalWrite(heatbutton_feed, LOW);
    }
    //---------------------------------------------------------------------
    delay(3000);
    if (digitalRead(ionisation_in)== HIGH) {
      if (val <900)                         {         // ionisation if LOW
        digitalWrite(lockoutled,      HIGH);
        delay(10);
        digitalWrite(heatbutton_feed, LOW);
      }
    }

    if (digitalRead(photo_pressure)==LOW)  {          // photo if LOW
      delay(10);
      digitalWrite(lockoutled,       HIGH);
      delay(10);
      digitalWrite(heatbutton_feed,  LOW);
    }
    //---------------------------------------------------------------------
    else {
      digitalWrite(ignition_fan_2, LOW);
    }
  }
  //---------------------------------------------------------------------
  else {                                      // switching off
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                 // resetting the count
    delay(1000);
    digitalWrite(relay230_24,    LOW);
  }
  if (lastHeatButtonState == HIGH) {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      previousMillis = currentMillis;   

      if (HeatButtonState == HIGH)
        HeatButtonState = LOW;

      digitalWrite(fan, HeatButtonState);
    }
  }

  //---------------------------------------------------------------------

}


204  Using Arduino / Project Guidance / Re: heating control on: June 22, 2012, 11:08:13 am
Quote

Insert Quote

The only time previousMillis is ever set is after it's longer than the interval. It looks like you need to set the previousMillis variable to the current time the instant that the button goes from HIGH to LOW

ok how do i do that then?

Quote

Insert Quote

I've read half this thread. I have an idea why you want the delay but if I'm wrong Just ignore my post.

Most commercial furnaces have temp sensors on the fan circuit to make sure the fan keeps running after the burners quit. While you can continue to guess at this I think you would be better off installing a temp sensor and using that to turn off the fan.

That said I agree with everyone. Learn blink no delay and learn it well.

yes a temp sensor on the burner chamber would be better but im making this for a direct repalcement for a control curcuit what is not manufactured anymore
205  Using Arduino / Project Guidance / Re: heating control on: June 21, 2012, 02:46:13 pm
Code:


const int heatbutton     = 2 ;
const int ignition_fan_2 = 10;
const int saleswitch     = 4 ;
const int solenoid       = 12;
const int photo_pressure = 3 ;
const int lockoutled     = 8 ;
const int heatbutton_feed= 5 ;
const int fan            = 9 ;
const int relay230_24    = 11;
const int ionisation_in  = 7 ;
int ionisation           = 5 ;   
bool DoneInitialization = false;       
// Variables will change:
int fanState = LOW;             // fanState used to set the fan
long previousMillis = 0;        // will store last time fan was updated
long interval = 20000;          // dleay time
void setup()
{
  pinMode(heatbutton,       INPUT );   
  pinMode(ignition_fan_2,   OUTPUT);
  pinMode(saleswitch,       INPUT );
  pinMode(solenoid,         OUTPUT);
  pinMode(photo_pressure,   INPUT );
  pinMode(lockoutled,       OUTPUT);
  pinMode(heatbutton_feed,  OUTPUT);
  pinMode(fan,              OUTPUT);
  pinMode(relay230_24,      OUTPUT);
  pinMode(ionisation_in,    INPUT );
  //-------------------------------------------
  digitalWrite(heatbutton_feed, HIGH);
}

void loop() {
  int val = analogRead(ionisation);
  //--------------------------------------------------------------------

  if (digitalRead(heatbutton)==        HIGH) {
    delay(10);    //debounce
    if (!DoneInitialization)
    {                                                 
      if (digitalRead(ionisation_in)==   HIGH) {           // if ionisation swith HIGH
        if (val >900) {                                       
          digitalWrite(lockoutled,            HIGH);
         delay(10);
          digitalWrite(heatbutton_feed,       LOW);
          return;
        }
      }   
      else {
        if (digitalRead(photo_pressure)==     HIGH) {         // if photo swith HIGH
        delay(10);
          digitalWrite(lockoutled,            HIGH);
         delay(10);         
          digitalWrite(heatbutton_feed,       LOW);
         return;
       }
      }
      digitalWrite(fan,                    HIGH);
      delay(3000);       
     
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==HIGH) {           // sale switch if HIGH
    digitalWrite(relay230_24,    HIGH);        // 230V out put to ignition
    digitalWrite(ignition_fan_2, HIGH);
    delay(1000);
      digitalWrite(solenoid,     HIGH);
    }
    DoneInitialization=true;                           // Initialization is done, don't run it again until button has been low
    }
    //---------------------------------------------------------------------
    if (digitalRead(saleswitch)==   LOW) {          // sale switch if LOW
      digitalWrite(lockoutled,      HIGH);
      digitalWrite(solenoid,        LOW);
      digitalWrite(fan,             LOW);
       delay(10);
      digitalWrite(heatbutton_feed, LOW);
    }
    //---------------------------------------------------------------------
    delay(3000);
    if (digitalRead(ionisation_in)== HIGH) {
      if (val <900)                         {            // ionisation if LOW
        digitalWrite(lockoutled,      HIGH);
        delay(10);
        digitalWrite(heatbutton_feed, LOW);
      }
    }

    if (digitalRead(photo_pressure)==LOW)  {          // photo if LOW
      delay(10);
      digitalWrite(lockoutled,       HIGH);
      delay(10);
      digitalWrite(heatbutton_feed,  LOW);
    }
    //---------------------------------------------------------------------
    else {
      digitalWrite(ignition_fan_2, LOW);
    }
  }
    //---------------------------------------------------------------------
    else {                                          // switching off
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                    // resetting the count
    delay(500);
    digitalWrite(relay230_24,    LOW);
     unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   
   
if (fanState == HIGH)
      fanState = LOW;
   
    digitalWrite(fan, fanState);
  }
    }
  //---------------------------------------------------------------------

}

206  Using Arduino / Project Guidance / Re: heating control on: June 21, 2012, 01:39:38 pm
ok i have this now working in a manner of speaking the delay seems to start as soon as its powered up instead of just when the button goes low ?

Code:

else {                                          // switching off
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                    // resetting the count
    delay(500);
    digitalWrite(relay230_24,    LOW);
     unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   
   
if (fanState == HIGH)
      fanState = LOW;
   
    digitalWrite(fan, fanState);
  }
    }
this at the top of the code
int fanState = LOW;           
long previousMillis = 0;       
long interval = 20000;
207  Using Arduino / Project Guidance / Re: heating control on: June 19, 2012, 02:31:58 pm
Quote

Use a stopwatch or timer instead of delay, delay will freeze the thread until the delay is up.

ok
does anybody have any examples for this that would be helpful to my project?
208  Using Arduino / Project Guidance / Re: heating control on: June 18, 2012, 02:59:22 pm
still having issues ive given up looking at the blink without delay as the more i look at it the more confused im getting so had a look generally on the internet and come across this idea but still doesnt work i seemed to get it to not have a delay or have an endless delay
doing my head in now lol

Code:

 else {                                          // switching off
    digitalWrite(solenoid,       LOW);
    digitalWrite(ignition_fan_2, LOW);
    DoneInitialization=false;                    // resetting the count
    delay(1000);
    digitalWrite(relay230_24,    LOW);
          static unsigned long starttime;
          static int fanstate = LOW;
    if (fanstate == LOW && millis() - starttime > 10000) {
        fanstate = HIGH;
        digitalWrite(fan,           LOW);
        starttime = millis();
    }
  }
209  Using Arduino / Project Guidance / will this work on a attiny45 on: June 16, 2012, 10:54:44 am
hi there will this work on a attiny45 be for i purchase one?

Code:

// digital
const int led2    = 0;
const int led3    = 1 ;
// analog
int knockinput    = 3 ;
int led1    =       2 ;


//       attiny45 / attiny85
//
//             +-\/-+
//      Reset 1|    |8 Vcc
//      (A 3) 2|    |7 (A 1)
//      (A 2) 3|    |6 (D 1) PWM1
//        GND 4|    |5 (D 0) PWM0
//             +----+

void setup() {
  pinMode(led2,   OUTPUT);   
  pinMode(led3,   OUTPUT);

}

void loop() {
    int val = analogRead(knockinput);
    if (val >256) {
      analogWrite(led1,   255);
    }
    else {
      analogWrite(led1,   0);
    }
    //------------------------------
    if (val >512) {
      digitalWrite(led2,   HIGH);
    }
    else {
      digitalWrite(led2,   LOW);
    }
    //-------------------------------
    if (val >768) {
      digitalWrite(led3,   HIGH);
    }
    else {
      digitalWrite(led3,   LOW);
    }
}
210  Using Arduino / Project Guidance / Re: heating control on: June 08, 2012, 04:30:23 pm
i have looked and looked and i dont understand it hence why i have posted this to seek help.
and i have written the whole of this code apart from the delay without delay which is what i dont understand. hence why i am asking.
Pages: 1 ... 12 13 [14] 15 16 ... 20