Looking for help with coding for a pic
i just got my picaxe starter kit (the 08M, 4 mhz, 256 lines of code and 1 inter, 5 input/outputs) and was toying around with creating a startup/shutdown controller. i have some real simple code that i am playing with and was looking for someone who may give some input to this. my thought was to control an inverter through relay control and the pulse for the start and shutdown on the pc case by .
Looking for ideas to make this better. I really am just a beginner and have just been looking at the online tutorials and building the simple stuff.
the code right now is just:
wait 4 ;wait about 4 sec for crank after the power on
if pin2 = 1 then startup
wait 3 ;time for inverter to click on
sleep 12 ;low power mode for 30 sec
if pin2 = 0 then turnoff
if pin2 = 1 then car_on ;checks every ~30 sec to see if the car is still on
i know that this is beginner stuff, that is why i am asking for input. making this better? situations i haven't thought of?
thanks in advance
forgot to add,
pin2 will be high when the car turns on, and low when it turns off (will also have a toggle switch to stop computer boot up)
pin3 is to relay for inverter
pin4 is to relay to computer power
555 timer will give power to circuit for 110 sec as a one shot