I'm fairly new to Arduino and only messing around with the most basic of programmes. I'm mainly hardware based in my experience so would usually find an 'analogue' based approach.
I'm hoping someone could help me with a programme whereby ...
Upon power up a pin (say pin 1) is pulled high
After 1 hour, that same pin (say pin 2) is pulled low
The micro waits until a different pin is pulled low to restart the timer.
I know it's probably fairly simple where it looks to see if the hour has elapsed AND if pin 2 has been pressed or something like that but like I said I'm a total noob with programming with zero spare time to watch tutorials so some help would be forever appreciated.
Try again. If the pin is Pin 1, that same pin can't be Pin 2. I recommend using Pin 2 as the output pin.
Perhaps Pin 3?
So you want Pin 2 to go HIGH when your sketch starts or when Pin 3 is LOW? One hour after the latter of the time the sketch started and the time Pin 3 was last LOW, Pin 2 should go LOW?
Not sure if it will help to get some context in the project this programme is for.
I have a unit with back up batteries. This unit gains it's main power from a battery charger type power brick which controls the charging voltage depending on the current being drawn. The original designers of this cabinet decided to power the control module from the same supply since the control module houses battery monitoring.
Because the control module draws current of its own, the charging module still thinks the batteries need a higher 'boosted' voltage. This is dangerously overcharging and ruining expensive lead acid batteries.
The idea was to allow the boosted voltage to remain untouched to reach the batteries for no longer than 1 hour then switch a relay in to connect a current limiter in series with a diode in series for reverse polarity protection of the current limiter. A reverse biased diode across the current limiter will allow back up power to reach the unit.
Thank you. Like I said, I'm a super noob at this. I can do all the hardware stuff and probably build this all from logic gates, BJT's and such. But would love to learn more about just giving instructions to a micro and it does what I want.
Maybe just practice makes perfect.
Why do I need 'Serial.begin'? I thought that was just for sending data to a port?
That's really only for debugging in this instance. It allows you to write (subsequent Serial.println() statements) to the serial monitor... very useful tool to see what is going on. You don't need it in your final version.