Ive used an arduino before but I didnt do the coding for it. Can an arduino monitor an input and only run a certain script when it changes (a 5v in as PWM and do one action when it goes form 5v to 0v and a different action when it does the opposite). If this is possible, would the cycle only involve checking the input every say 1 min and not run all the other code until it changes. So basically with A as the input when A goes from 5v to 0v then do X (or just when it goes to 0v) when A goes from 0v to 5v then do Y (or just when it goes to 5v) This might be a very fundamental question now that ive written it down
arduino are basically AVR's. so it's very easy to code for. two ways of doing this: pooling or interrupt. -pooling: flagX, flagY. while{ if A = 0v then do X, raise flagX, lower flagY if A = 5v then do Y, raise flagY, lower flagX } -interrupt: set A as interrupt input (interrupt only triggers on change, IIRC. ISR{ when A = 0v then do X when A = 5v then do Y } of course, i could be talking rubbish. i've coded for AVR's, and i've read Arduino uses AVR as its programmable processor.
quick google showed up this: http://gonium.net/md/2006/12/20/handling-external-interrupts-with-arduino/ the code in AVR-GCC tutorial link at the end looks very familiar to me. it seems Arduino uses a non-standard C, which enforces a healthy coding structure. AVR is indeed the programmable chip, which uses GCC compiler and takes standard C (good coding structure will look very similar to Arduino's code, except most things are in Main, loops have to be done manually).
yes, interrupt service routines are just a built-in function that will run when the set trigger happens. it's same as any other function you write.