Need help cleaning up some code to use to launch multiple videos


hi, i'm trying use arduino pir sensors launch videos stored on pc coupling arduino code simple python code.

anyway i'm having trouble launching second video (hoping launch alot more ultrasonics @ different distances, digress) knowledge of coding pretty basic. think i've confused heck out of myself trying shove in 'do while' loop remedy previous attempt @ triggering worked 1 video.

the 'object' isn't getting detected second pir i'm pretty sure have them hooked right , pir works tested code modified email sending pir code blatantly borrowed.

here's code
code: [select]
int pirpin1 = 7;
int pirpin2 = 8;

int minsecsbetweenvidlaunch = 60; // 1 min

long lastsend = -minsecsbetweenvidlaunch * 1000l;

void setup()
{
 serial.begin(9600);
 pinmode(pirpin1, input);
 pinmode(pirpin2, input);
}

void loop()
{
 long = millis();
 if (digitalread(pirpin1) == high)
 {
 if (now > (lastsend + minsecsbetweenvidlaunch * 1000l))
  {
   serial.println("movement");
   lastsend = now;
  }
  else
  {
   serial.println("too soon");
  }
 }
 delay(500);
 }
 do {
  serial.println("object");
 } while (digitalread(pirpin2) == high)
}


it doesn't work , i'm confused guys, please offer guidance.
thanks in advance, i've tried abide forum rules.

guidance:

always used 'unsigned long' variables millis().

always use (currentmillis - millisatstartofinterval) compared lengthofinterval see if interval has elapsed.


Arduino Forum > Using Arduino > Programming Questions > Need help cleaning up some code to use to launch multiple videos


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts