I need a C/C++ program for icemaker, (for a backup micro board for icemaker) that when
a input pin (B1?) receives DC5volt HI from icemaker freeze cycle for 18 minute it will out put a 5volts for the icemakers harvest cycle pin0 (powering relay/driver for harvice hot gas valve to heat and release ice so it can full to ice bin) for 7 minutes or tell a low to pin3 input indicating that the ice batch fell in to the ice bin(the icemakers factory board resets and starts a freeze cycle (first cycle) from this same low to its board (the Lo is from open bin switch about 1/2 secOnd min. from ice to and down past it as it fall into the ice bin).
Or in-short and non confusing I have a Arduino Nano Boards and need a sketch or example that:
HI at input pin 1 for 18 minutes.
Then after step 1) a HI at output pin 0 for 7 minutes
3)(Then it would be nice but can live with out) a LO at a input pin 2 to cut short Hi
at pin 0's 7 min cycle (cut short harvest cycle to save energy)
4)(Then it would be nice but can live with out as its much more)input pin 3 Lo to change 18Min to 16Min and low again to change back to 18 Min than LO again to change to 20 Min And maybe a LED/resistor 5v for each minutes setting, LED 5v out pin for 16 Min and LED 5v pin for 18 Min and 5v pin for a 20 min LED.
Then maybe the same for the 7 min cycle (harvice cycle) button and LEDs to lengthen the melt cycle, just to be green and maybe save energy or jut not to need to rewrite software if cycle to short. This in a different code language will work...
that the ice batch fell in to the ice bin(the icemakers factory board resets and starts a freeze cycle (first cycle) from this same low to its board (the Lo is from open bin switch about 1/2 second min. from ice to and down past it as it fall into the ice bin).
Or in-short and non confusing I have a Arduino Nano Boards and need a sketch that:
HI at input pin 1 for 18 minutes.
Then after step 1) a HI at output pin 0 for 7 minutes
3)(Then it would be nice but can live with out) A lo at a input pin 2 to cut short Hi
at pin 0's 7 min cycle (cut short harvice cycle to save energy)
4)(Then it would be nice but can live with out as its much more)input pin 3 Lo to change 18Min to 16Min and low again to change back to 18 Min than LO again to change to 20 Min And maybe a LED for each minutes setting, LED 5v out pin for 16 Min and LED 5v pin for 18 Min and 5v pin for a 20 min LED.
Then maybe the same for the 7 min cycle (harvice cycle) button and LEDs to lengthen the melt cycle, just to be green and maybe save energy or jut not to need to rewrite software if cycle to short. This in a different code language will work...
So sorry for the length and this questions, this is for a different forum that don't mind out of sketch questions...
Or in-short and non confusing I have a Arduino Nano Boards and need a sketch or example that:
So, start writing. There is noting even remotely complicated in your requirements. If some pin becomes HIGH (see the state change detection example), there is a series of things to do. So, do them.
Your requirements are fundamentally flawed, as you'll see when you try implementing them in code.
You can NOT make a input HIGH. You can only make an output HIGH. An input is something you read, NOT something you write.
I would suggest not to use pins 0 and 1; that might interfere with the upload and makes debugging your code much more difficult as you can't use the serial monitor.
Only use those if you run out of pins (what, from the description) does not seem to be the case.
"If" HI at input pin 1 for 18 minutes.
I did not put the "If".
And: A LO at a input pin 2 "from appliance", not: A LO at a input pin 2.
And I don't need an copy righted short form just long open forms. What I'm trying to do as Im a slow learner (very) is get by by just learning this much C/C++ as it applies to a microcontroller in a appliance (getting the appliance going tell I can find a cheap control board $450 for this ice maker), with out learning a new trade/hobby. I'm not foreseeing needing to do much more than just this and maybe inputting a analog input and hall effect sensor input "from an appliances" time to time. Thanks again as some forums don't put up with out of category/non meat of topic chatter, but I may save some poor people money time to time...
One thing to consider is what type of output the icemaker provides. Assuming both HIGH and LOW are defined levels (5V and 0V), you will be OK.
If only HIGH is defined as 5V and LOW is floating (e.g. an open relay contact), you will need a pull-down resistor on the input of the Nano.
If you don't know, the below will tell you. Connect the icemaker's 'freeze indication pin' to pin 2 of the Arduino
// the freeze indicator of the icemaker is connect to this pin
const byte pinFreezeIndicator = 2;
void setup()
{
Serial.begin(57600);
pinMode(pinFreezeIndicator, INPUT);
Serial.println("Ready");
}
void loop()
{
// read the status of the freezeIndicator and store
byte freezeStatus = digitalRead(pinFreezeIndicator);
// display the result
Serial.print("Freeze indication: ");
Serial.println(freezeStatus);
}
If the icemaker is not freezing, you should see an endless repeat of
under normal circumstances or when you e.g. touch the pin with your finger, your input is floating.
While the icemaker is freezing, you should see an endless repeat of
Freeze indication: 1
Another thing to consider might be the fact that the icemaker's output can bounce (depending on how it is implemented in the icemaker (e.g. relay contacts bounce). At the moment that you start implementing your 'nice to have' features with buttons, you will more than likely encounter that.
PaulS
Thanks, I was raised at washington state about 100 mi east of u, central Washington Sunnyside .
And sterretje WOOOOWWWWW!!!
Thanks SOOOOO MUCH!! I'm going over all now. Yes will use diode and resistors at inputs output , and relays have shunt diodes, and will use the commands in future software too.....
Look at the state change detection example. You care when the pin BECOMES high, so you can start the timing, or BECOMES low, so you can stop timing/clear the start time.
You also need to see if the pin IS high, and timing has started (the start time is not 0). That is completely separate from the test for the pin being high now vs. what state is was in last time you looked.
If the pin IS high and the start time is 18 minutes in the past, then do whatever needs doing, and clear the start time.