Code for Battery charger

Hi, I am trying to toggle a relay with a button switch (Start/Stop) that will connect/disconnect a battery and a charging circuit. Once started a timer must Stop the charging after approx 14 hours. A second press of the button switch within 14 hours must stop the charging. A further press of the button switch must start the timer from 0 (New cycle). Also if the battery voltage reaches 14,2v before timer reaches 14 hours the charging must stop. This is my first project and I cannot get all the functions to work to gether. So I am basically asking for code that will do this please.

Use the search box at the top of the page and look for "state machine".

Start you program with one part and get it going before moving on to the next.

Weedpharma