Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Project Guidance / Using PIR & multiple LEDs that get brighter over repeated triggers
|
on: November 17, 2012, 03:24:05 pm
|
|
I'm trying to set-up a sketch and don't know where to start. I want to have a PIR trigger multiple LEDs (using multiple pins) and as PIR continues to be triggered the light increases to brighten area being covered. *I would really like to have a new set of LEDs come on as motion continues, but will be satisfied with all LEDs getting brighter with continued motion. I've tried book, Arduino cookbook, using Google and cannot find sketch or basic foundation to build on. Please help.
|
|
|
|
|
5
|
Using Arduino / Microcontrollers / Need step-by-step to load bootloader to 328P
|
on: November 08, 2012, 06:07:54 pm
|
|
I'm stuck with 10 328P chips with no bootloader loaded on them prior. Is there a simple, step-by-step instruction with illustrations as to where to place wires. Searching the web there are 100's of ways to do it, and have yet to find one that works. Emphasis on actually works. All the instruction on this site (arduino.cc) seem to end in no communication between Uno or Duemilanove and breadboard set-up. I've trip Uno-to-uno, Duemilanove-to-Uno, Mega-to-Uno....nothing works. Please help and no flaming that there are resources out there already, I've tried. Simple instructions and point me in the right direction. Thank you
|
|
|
|
|
6
|
Using Arduino / LEDs and Multiplexing / Advanced Blink modification
|
on: March 18, 2012, 06:08:21 pm
|
I found following and want to modify it to handle 6+ ledpins. /*Advanced Blink SketchBy: David M. Orlowww.DaviedOrlo.com*/byte SWITCHPIN= 2; //Set Pin 2 as Switchbyte LEDPIN = 6; //Set Pin 6 as LEDbyte brightness; //Create a Integer variable named brightnessbyte delayedoff; //Create a Integer variable named delayedoffbyte delayedon; //Create a Integer variable named delayedon//If you want to go higher than 255 you must change from "byte" to "int"boolean buttonstate; //Create a Integer variable named buttonstate void setup() { pinMode(SWITCHPIN, INPUT); //Set Pin 2 as InputpinMode(LEDPIN, OUTPUT); //Set Pin 6 as Output} void loop() { buttonstate = digitalRead(SWITCHPIN); //Continually look at the switch to see if its pressedif (buttonstate == HIGH) //If the switch goes HIGH, act on it{ crazyLED(); //Now we go into a new function called crazyLED} } void crazyLED() //crazyLED function we created and called whatever we want{ buttonstate = LOW; //First we tell the micro the switch is now LOWdelay(250); while (buttonstate == LOW) //White the switch is NOT pressed we do the following{ buttonstate = digitalRead(SWITCHPIN); //Continually look at the switch to see if its pressedbrightness = random(1, 254); //Generates a random number from 1-254 and assigns it to the variable named brightnessdelayedoff = random(1, 125); //Generates a random delay and assigns it to the variable named delayeddelayedon = random(1, 250); //Generates a random delay and assigns it to the variable named delayedanalogWrite(LEDPIN, brightness); //Uses the random number we generated to write the value to our LEDdelay(delayedon); //random delay on timeanalogWrite(LEDPIN, 0); //We turn the LED off for a blinking effectdelay(delayedoff); //Random delay off time} //Once the switch is pressed again we break out of the loop above and then break out of the function completely and go back to our main loopbuttonstate = LOW; //First we tell the micro the switch is now LOWanalogWrite(LEDPIN, 0); //We turn the LED off before leaving our custom functiondelay(500); } [/sub] Thank you very much for any help you can give.
|
|
|
|
|
7
|
Using Arduino / LEDs and Multiplexing / Re: LEDs for Pin 10 and Pin 11
|
on: March 22, 2011, 03:55:52 pm
|
I was wondering how I can work a pseudorandom long integer into sketch using: long randnum = random(0, 100); //a number between 0 and 99 Thanks // fading LEDs
int value = 0;
void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); }
void loop() { for(value = 0; value <= 255; value+=5) // fade LEDs in { analogWrite(2, value); analogWrite(3, value); analogWrite(4, value); analogWrite(5, value); analogWrite(6, value); analogWrite(7, value); analogWrite(8, value); analogWrite(9, value); analogWrite(10, value); analogWrite(11, value); analogWrite(12, value); analogWrite(13, value); delay(30); // take 30 mili seconds to fade in } delay(200); // leave the LEDs on for 200 milliseconds
for(value = 255; value >=0; value-=5) // fade LEDs out { analogWrite(2, value); analogWrite(3, value); analogWrite(4, value); analogWrite(5, value); analogWrite(6, value); analogWrite(7, value); analogWrite(8, value); analogWrite(9, value); analogWrite(10, value); analogWrite(11, value); analogWrite(12, value); analogWrite(13, value); delay(30); // take 30 mili seconds to fade out } delay(1000); // leave LEDs off for 1 second
for(value = 0; value <= 255; value+=5) // fade LED 5 in { analogWrite(5, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 5 out { analogWrite(5, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 2 in { analogWrite(2, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 2 out { analogWrite(2, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 3 in { analogWrite(3, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 3 out { analogWrite(3, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 4 in { analogWrite(4, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 4 out { analogWrite(4, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 6 in { analogWrite(6, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 6 out { analogWrite(6, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 7 in { analogWrite(7, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 7 out { analogWrite(7, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 8 in { analogWrite(8, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 8 out { analogWrite(8, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 9 in { analogWrite(9, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 9 out { analogWrite(9, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 10 in { analogWrite(10, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 10 out { analogWrite(10, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 12 in { analogWrite(12, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 12 out { analogWrite(12, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 13 in { analogWrite(13, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 13 out { analogWrite(13, value); delay(30); }
for(value = 0; value <= 255; value+=5) // fade LED 11 in { analogWrite(11, value); delay(30); } for(value = 255; value >=0; value-=5) // fade LED 11 out { analogWrite(11, value); delay(30); } }
|
|
|
|
|
8
|
Using Arduino / LEDs and Multiplexing / Re: fading several led's (each at a different time)
|
on: March 20, 2011, 04:34:24 pm
|
|
Is there a simple way of telling me how to integrate random numbers for length of LED being lit/unlit? I see the code in Getting Started With Arduino (p108) and I have no idea where to put it. I want to do the same as original post, each LED different value with random numbers. I have following code to try to work into sketch: long randnum = random(0, 100);
Thank you
|
|
|
|
|