hi all, i have spent the last week doing as suggested on this and other sites and reading as much as i can.
i have an arduino with a tinkerkit sensor sheild fitted for this project.
this is for my work and hopefully will be fitted in a finished product.
basically it will control a simple RO (reverse osmosis) unit.
i have succesfully run blink etc and modded it a bit
what it needs to do: wait 20 seconds,check the inlet pressure is not below a setpoint(this is a pressure switch so just on/off)
if no pressure,wait 20 seconds again(do this max 5 times)if still no pressure,light warning lamp and wait 30 minutes then repeat.
if pressure ok, check for high pressure, if high, stop and light warning lamp.
if ok run pump relay
edit: hopefully this will constantly check those inputs while running, or am i missing something?
below is where i have got to now but am struggling where to start next so would be gratefull for a clue ![]()
also, can the reset button on the arduino be accessed via the pins or does it just reset the board?
[quote]
[color=#7E7E7E]// ro progam//[/color]
[color=#7E7E7E]// setup pressure switches and pump relay//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] LowPress = A0; [color=#7E7E7E]//low pressure switch//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] HighPress = A1; [color=#7E7E7E]//high pressures switch//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] relay = 03; [color=#7E7E7E]// pump relay//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] OnLamp = 00; [color=#7E7E7E]// on/run lamp[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] FaultLamp = 01; [color=#7E7E7E]//stop/fault lamp//[/color]
[color=#7E7E7E]// set the states of the pins//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] [color=#CC6600]state[/color] = [color=#006699]HIGH[/color]; [color=#7E7E7E]// current state of the output pin//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] = reading; [color=#7E7E7E]// current reading from the input pin//[/color]
[color=#CC6600]const[/color] [color=#CC6600]int[/color] = previous = [color=#006699]LOW[/color]; [color=#7E7E7E]// previous reading fro input pin//[/color]
[color=#7E7E7E]//debounce for switches//[/color]
[color=#CC6600]long[/color] time =0;
[color=#CC6600]long[/color] debounce =200;
[color=#7E7E7E]// setup pins as in/out//[/color]
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
[color=#CC6600]pinMode[/color](LowPress,[color=#006699]INPUT[/color]); [color=#7E7E7E]//low pressure switch//[/color]
[color=#CC6600]pinMode[/color](HighPress,[color=#006699]INPUT[/color]); [color=#7E7E7E]//high pressure switch//[/color]
[color=#CC6600]pinMode[/color](relay,[color=#006699]OUTPUT[/color]); [color=#7E7E7E]//pump relay//[/color]
[color=#CC6600]pinMode[/color](OnLamp,[color=#006699]OUTPUT[/color]); [color=#7E7E7E]//on/run lamp//[/color]
[color=#CC6600]pinMode[/color](FaultLamp,[color=#006699]OUTPUT[/color]); [color=#7E7E7E]//stop/faultlamp//[/color]
}
[color=#7E7E7E]//start,wait 20 seconds while check inlet low press,if low,wait again(do this max 5 times)if still no pressure,light fault lamp, wait 30 minutes and try routine again.//[/color]
[color=#7E7E7E]//if pressure ok, check high pressure, if high,stop and light fault lamp. if ok run pump and light on lamp//[/color]
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
[color=#CC6600]delay[/color] (20000);
[/quote]