Show Posts
|
|
Pages: 1 [2] 3 4
|
|
17
|
Using Arduino / Project Guidance / twinkle led's
|
on: September 16, 2012, 03:03:13 pm
|
|
hi all i know the mega wich i have has got Digital I/O Pins 54 (of which 15 provide PWM output) can i get all the 54 pins to twinkle an individual led like stars in the sky at night in a random pattern ?? or what would be the better alternative?
|
|
|
|
|
21
|
Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's
|
on: July 05, 2012, 04:59:00 pm
|
this sketch works on my mega can anyone see any errors with it ? /* Blink Turns on an LED This example code is in the public domain. */
void setup() { // initialize the digital pin as an output. // Pin 2/ has an LED connected on most Arduino boards: pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); }
void loop() { digitalWrite(2, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(2, LOW); // set the LED off delay(0); // wait for a second digitalWrite(3, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(3, LOW); // set the LED off delay(0); // wait for a second digitalWrite(4, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(4, LOW); // set the LED off delay(0); // wait for a second digitalWrite(5, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(5, LOW); // set the LED off delay(0); // wait for a second digitalWrite(6, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(6, LOW); // set the LED off delay(100); // wait for a second digitalWrite(7, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(7, LOW); // set the LED off delay(100); digitalWrite(3, HIGH); digitalWrite(6, HIGH); delay(50); digitalWrite(3, LOW); digitalWrite(6, LOW); delay(500); digitalWrite(4, HIGH); digitalWrite(5, HIGH); delay(50); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(4, HIGH); delay(100); digitalWrite(4, LOW); delay(100); } |
|
|
|
|
|
27
|
Using Arduino / Programming Questions / simultaneously turn on 2 led's
|
on: July 04, 2012, 05:26:39 pm
|
|
hi all i'm using this sketch to flash led's at the end of the sketch i would like to flash leds on pins 4 and 7 simultaneously can any one tell me if its possible and how to do it thanks marko
/* Blink Turns on an LED This example code is in the public domain. */
void setup() { // initialize the digital pin as an output. // Pin 2/7 has an LED connected on most Arduino boards: pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); }
void loop() { digitalWrite(2, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(2, LOW); // set the LED off delay(0); // wait for a second digitalWrite(3, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(3, LOW); // set the LED off delay(0); // wait for a second digitalWrite(4, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(4, LOW); // set the LED off delay(0); // wait for a second digitalWrite(5, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(5, LOW); // set the LED off delay(0); // wait for a second digitalWrite(6, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(6, LOW); // set the LED off delay(2000); // wait for a second digitalWrite(7, HIGH); // set the LED on delay(50); // wait for a second digitalWrite(7, LOW); // set the LED off delay(50); }
|
|
|
|
|