Hi, I'm making UV pcb exposure box,i have everything setup,and I would like arduino to control working time of UV lights,I have relay and I don't know how to make a code and what to control it with.I have cuple of momentary switches and lcd display.I hope someone can help me with this,what shoud I do,thanks.
tell more.. component details for relay.
The code you need isn't much..
So I have arduino nano,LCD,momentary switches,relay(it works on arduino,I tested it) and 220v UV light bulb,I would need a program that lets me select time by clicking buttons.I don't know how to explain it better,im new to arduino and english is my second language,so sorry if you don't understand.Thanks
If time is fixed, you only need the 'start-command' (an SPST push-button)
if we assume :
- relay need a high puls.
- push-button connects pin to gnd.
#define lightpin 4 // pin 5 for relay
#define startpin 5 //
#define lightperiod 20000 // 20 seconds when triggered
void setup()
{
pinMode lightpin(OUTPUT);
pinMode startpin(INPUT_PULLUP);
}
void loop()
{
while (digitalRead(startpin)) ; // wait for you to push button
digitalWrite(lightpin,HIGH); // turn light on
delay(lightperiod); // just wait
digitalWrite(lightpin,LOW); // turn light off
}
Add code for your LCD
Add two more pushbuttons, one=incr. time, the other=decr. time
byte lightpin=4 ;
byte startpin=5;
byte addpin=6;
byte subpin=7;
long lightperiod = 20000; // 20 sec defalt
void shownumber()
{
// add code to show "lightperiod" on the lcd
}
void setup()
{
pinMode (lightpin,OUTPUT);
pinMode (startpin,INPUT_PULLUP);
pinMode (addpin,INPUT_PULLUP);
pinMode (subpin,INPUT_PULLUP);
shownumber();
}
void loop()
{
if (!digitalRead(startpin)) ; // wait for you to push button
{
digitalWrite(lightpin, HIGH); // turn light on
// tell on display ??
delay(lightperiod); // just wait
digitalWrite(lightpin, LOW); // turn light off
}
if (!digitalRead(addpin))
{
lightperiod += 1000; // add a second
shownumber();
}
if (!digitalRead(subpin))
{
if (lightperiod>1000) lightperiod -= 1000; // add a second
shownumber();
}
delay(100); // to avoid 'racing' numbers.. try without it
}