Announcement

Collapse
No announcement yet.

Looking for help with coding for a pic

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:

    main:
    wait 4 ;wait about 4 sec for crank after the power on
    if pin2 = 1 then startup
    goto main

    startup:
    low 3
    pause 100
    high 3
    wait 3 ;time for inverter to click on
    low 4
    pause 100
    high 4
    pause 500
    low 4
    goto car_on

    car_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

    turnoff:
    high 4
    pause 500
    low 4
    wait 50
    low 3
    end


    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
Working...
X