sorry this is such a newb question....
running a simple bit of code to read pulses...this in itself is done...but for some reason i cannot get a trigger to work..
any idea please...
we have pulses coming in, 3 states, when the state changes..for example pulses go over 1700, we change to state 3..when this happens i need to output a simple bit of code (already taken care of)
what i DONT want to do is continually send the same commands out when in state 3, only when it changes from state 2 to 3 ..3 to 2..2 to 1...so forth and so on...
Here is my very simple starters of the code..
int zoomp = 7;
//int contr = 8;
int zcom = 0;
int ccom = 0;
int var = 0;
int prin = 0;
unsigned long duration1;
//unsigned long duration2;
duration1 = pulseIn(zoomp, HIGH);
//duration2 = pulseIn(contr, HIGH);
//read pulses do summet..
if (duration1 >1700)
else if (duration1 < 1300)
else if (duration1 > 1300 && duration1 <1700)
//commands out if changes
if (zcom == zcom)
prin = 0;
prin = 1;
if (prin == 0)
var = zcom;
I have tried comparing the INT from every loop so when i changes it makes another INT 1 not 0 then do the case..but no luck..and i cant find any examples of this.
Im sure its really simple but i cant get it to work. :-[
Many thanks in advance fro any help.