Arcade and Pir sensor
hello add pir sensor turn off leds suggestions,
i didn't write code modify , add own
demo starting pir sensor newbie
i didn't write code modify , add own
demo starting pir sensor newbie
code: [select]
/*
arrays
uses arrays turn on multiple lights.
*/
//set pins using array
int led[10] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
//setup led pins
void setup() {
(int = 0; < 10; i++) {
pinmode(led[i], output);
}
}
//function making lights flash
void flashlights() {
(int = 0; < 10; i++) {
digitalwrite(led[i], low);
}
(int = 0; < 10; a++) {
(int = 0; < 10; += 2) {
digitalwrite(led[i], high);
}
delay(500);
(int = 0; < 10; += 2) {
digitalwrite(led[i], low);
}
(int = 1; < 10; += 2) {
digitalwrite(led[i], high);
}
delay(500);
(int = 1; < 10; += 2) {
digitalwrite(led[i], low);
}
}
}
//function making lights 'move'
void movelights() {
(int = 0; < 10; i++) {
digitalwrite(led[i], low);
}
(int = 0; < 20; a++) {
(int = 0; < 10; += 3) {
digitalwrite(led[i], high);
}
delay(350);
(int = 0; < 10; += 3) {
digitalwrite(led[i], low);
}
(int = 1; < 10; += 3) {
digitalwrite(led[i], high);
}
delay(350);
(int = 1; < 10; += 3) {
digitalwrite(led[i], low);
}
(int = 2; < 10; += 3) {
digitalwrite(led[i], high);
}
delay(350);
(int = 2; < 10; += 3) {
digitalwrite(led[i], low);
}
}
}
//function making lights count up.
void countlights() {
(int = 0; < 10; i++) {
digitalwrite(led[i], low);
}
(int = 0; < 10; i++) {
digitalwrite(led[i], high);
delay(1000);
}
(int = 0; < 35; a++) {
(int = 0; < 10; i++) {
digitalwrite(led[i], high);
}
delay(40);
(int = 0; < 10; i++) {
digitalwrite(led[i], low);
}
delay(40);
}
}
//finally, run program 3 programs!
void loop() {
countlights();
movelights();
flashlights();
}
anyone considering answering should read first:-
http://forum.arduino.cc/index.php?topic=417242.msg2873329#msg2873329
http://forum.arduino.cc/index.php?topic=417242.msg2873329#msg2873329
Arduino Forum > Using Arduino > LEDs and Multiplexing > Arcade and Pir sensor
arduino
Comments
Post a Comment