Trouble running simple processing code to Arduino


i relatively new this... i'm trying use arduino control leds art project.  i have 3 motion sensors, each 1 controls different led.  i want leds come on when respective sensor detects motion.  with code below, leds come on when sensor tripped, if 3 sensors tripped @ same time (or in combination of 2), not come on together.  can me fix simple code?  thanks much!!

void setup()
{
 pinmode(5, input);
 pinmode(6, input);
 pinmode(7, input);
 pinmode(11, output);
 pinmode(12, output);
 pinmode(13, output);

 serial.begin(9600);
}

void loop()
{
 if(digitalread(5)==1)
 {
   digitalwrite(11,1);
   delay(10000);
 }
 
 if(digitalread(5)==0)
{
   digitalwrite(11,0);
   delay(10000);
 }

if(digitalread(6)==1)
 {
   digitalwrite(12,1);
   delay(10000);
 }
 
 if(digitalread(6)==0)
{
   digitalwrite(12,0);
   delay(10000);
}

if(digitalread(7)==1)
 {
   digitalwrite(13,1);
   delay(10000);
 }
 
 if(digitalread(7)==0)
{
   digitalwrite(13,0);
   delay(10000);
}

}

sure thing. delay what's killing you. @ blinkwithoutdelay example solution.

basically, need turn leds on , record when turned them on.

then, each pass through loop, see if it's time turn led off.


Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Trouble running simple processing code to Arduino


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums