Tell us about yourself!

Complete Your Profile
  • Multiple Blinking LED on the Arduino

    By the way you can also do it in a much simpler manner using delay(). //turns on leds 3 and 4 for 500 millisecdigitalWrite(3, HIGH);digitalWrite(4, HIGH);delay(500);//turns off leds 3 and 4 for 500 millisecdigitalWrite(3, LOW);digitalWrite(4, LOW);delay(500);

    for this you will need to multitask. Look into the millis() function.Search: aduino multitasking to learn morehere's the code:class Flasher{// Class Member Variables// These are initialized at startupint ledPin; // the number of the LED pinlong OnTime; // milliseconds of on-timelong OffTime; // milliseconds of off-time// These maintain the current stateint ledState; // ledState used to set the LEDunsigned long previousMillis; // will store last time LED was updated // Constructor - creates a Flasher // and initializes the member variables and state public: Flasher(int pin, long on, long off) {ledPin = pin;pinMode(ledPin, OUTPUT); OnTime = on;OffTime = off;ledState = LOW; previousMillis = 0; } void Update() { // check to see if it's time to change ...

    see more »

    for this you will need to multitask. Look into the millis() function.Search: aduino multitasking to learn morehere's the code:class Flasher{// Class Member Variables// These are initialized at startupint ledPin; // the number of the LED pinlong OnTime; // milliseconds of on-timelong OffTime; // milliseconds of off-time// These maintain the current stateint ledState; // ledState used to set the LEDunsigned long previousMillis; // will store last time LED was updated // Constructor - creates a Flasher // and initializes the member variables and state public: Flasher(int pin, long on, long off) {ledPin = pin;pinMode(ledPin, OUTPUT); OnTime = on;OffTime = off;ledState = LOW; previousMillis = 0; } void Update() { // check to see if it's time to change the state of the LED unsigned long currentMillis = millis(); if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime)) { ledState = LOW; // Turn it off previousMillis = currentMillis; // Remember the time digitalWrite(ledPin, ledState); // Update the actual LED } else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime)) { ledState = HIGH; // turn it on previousMillis = currentMillis; // Remember the time digitalWrite(ledPin, ledState); // Update the actual LED } }};Flasher led1(12, 350, 350);Flasher led2(13, 350, 350);void setup(){}void loop(){led1.Update();led2.Update();}taken from: https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution

    View Instructable »
  • How to Make LEDs Flash to Music With an Arduino

    try the followingIsaack19Replya year agoWorks great! I used an Arduino R3 and it works fine. In processing, if you are missing libraries, go to "Sketch > Import Library > Add Library" and add "Arduino (Firmata)" and "Minim". Also changing"arduino = new Arduino(this, Arduino.list()[1], 57600);"to:"arduino = new Arduino(this, Arduino.list()[0], 57600);"made it work.

    View Instructable »