Hi All
I am having trouble getting the code to react to the HIGH or LOW interrupt I'm telling it to look for.
I can see the voltage change on a mulitmeter but the code just continues running.
Hopefully I've added enough info to code of what I am trying to do for it to make sense
Any help would be good.
Thanks in advance.
//This project is designed to run a cooking cycle on an oven with a touch screen.
//Solenoids are fitted to a bracked mounted infront of the touch screen replicating a users finger making presses.
//Three presses should be made, going through each stage of the cookbook till the recipe is selected.
//The oven will then request user input to start the cook cycle. I have chosen to switch the door circuit open and closed triggering the cook to start.
//A relay has been wired to the 0V and 230V on the HV MAG transformer to trigger a relay to close, the close here creates the circuit for the 5V to be read by the uWSignal.
//Whilst uWSignal is reading HIGH, ButtonPress and DoorOpenClose should be LOW.
//Once the cooking has finished the/MAGs are off, the DoorOpenClose should be the next thing to trigger.
// Process should be
// "Button press X 3"
// "DoorOpenClose X1"
// cook started
// "uWSignal digitalRead == HIGH"
// End of cook
// "uWSignal digitalRead == LOW"
// "DoorOpenClose X1"
//IO
int ButtonPress = 13; // solinoid on relay CH1
int DoorOpenClose = 11; //open door relay CH2
int uWSignal = 2; //Read cooking
int SenduWSignal = 7; //5v signal to relay
void setup(){
{
//IO Modes
pinMode(uWSignal, INPUT); //Reads a signal from HV transformers when mags are switched on. Signal (SenduWSignal) closes the relay sending 5V to uWSignal
pinMode(ButtonPress, OUTPUT); //CH1 on relay controling the switching of a solenoid making "presses"
pinMode(DoorOpenClose, OUTPUT); //CH2 on relay. opening and closing the door safety circuit this triggers the start of the Mags/cooking.
pinMode (SenduWSignal, OUTPUT);//5volts going to the relay creating the 5V read for uWSignal.
}
{
Serial.begin(9600);
}
}
void loop()
{
{
//Solenoid making presses
digitalWrite(ButtonPress, HIGH); // Makes a press.
delay(500); // wait for a second
digitalWrite(ButtonPress, LOW); // waiting
delay(500); // wait for a second
}
{
digitalWrite(ButtonPress, HIGH); // Makes a press
delay(500); // wait for a second
digitalWrite(ButtonPress, LOW); // wating
delay(500); // wait for a second
}
{
digitalWrite(ButtonPress, HIGH); // Makes a press
delay(500); // wait for a second
digitalWrite(ButtonPress, LOW); // waiting
delay(500); // wait for a second
//Oven waiting for user input
}
{
//START THE COOK CYCLE - DOOR OPEN/close
digitalWrite(DoorOpenClose, HIGH); // open the door
delay(2000); // wait
digitalWrite(DoorOpenClose, LOW); // close the door
delay(2000); // wait
//Oven cooking
}
{
//End of cook door open/close
digitalWrite(DoorOpenClose, HIGH); // Open the door
delay(2000); // wait
digitalWrite(DoorOpenClose, LOW); // Close the door
delay(2000); // wait
}
//When the cook starts the signal from the transformers should be read writing all outputs to low untill the cook has finished.
//the end of cook door open/close should be the next thing to trigger.
{
digitalRead (uWSignal);
if(uWSignal == HIGH){
digitalWrite(DoorOpenClose, LOW);
delay(250);
digitalWrite(ButtonPress, LOW);
delay(250);
}
else{
}
}
//below is serial printing the status of the inputs/outputs.
{
if(uWSignal == CHANGE) {
Serial.print ("\nuWSignal Status = 1");
}
else {
}
}
{
if(ButtonPress == CHANGE) {
Serial.print("\nButtonPress Status = 1");
}
else {
}
}
{
if(DoorOpenClose == CHANGE) {
Serial.print ("\nDoorOpenClose Status = 1");
}
else {
}
}
}