Results 1 to 1 of 1
  1. #1
    Nintendo Section Moderator PvtRyan's Avatar

    Badge

    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,581
         User Info     Contact     Gamer ID
    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,581
    Gamer IDs

    PSN ID: gamer_pvtryan Steam ID: pvtryan_cl Wii Code: PvtRyan

    Contact info:

    Youtube Channel: http://www.youtube.com/xPvtRyanx

    Default [Arduino]2 way LED Circuit

    Descripion: 2 Led flash back and forth with Arduino Uno
    Download File: http://www.mediafire.com/?vxeambvyv3ghcup
    Code:
    Code:
    const int anode = 9;//Pin for led 1(anode side)
    const int anode2 = 8;//Pin for led 2(anode side)
    const int cathode = 12;//the cathode for both leds
    int ON = HIGH;
    long previousMillis = 0; 
    int OFF = LOW;
    int ledA = HIGH;
    int ledB = LOW;
    long delayT = 500;  
    
    void setup()
    {
      pinMode(anode, OUTPUT);
      pinMode(anode2, OUTPUT);
      pinMode(cathode, OUTPUT);1
    } 
    
    void loop()  
    {
      unsigned long currentMillis = millis();  
      if(currentMillis - previousMillis > delayT)
      {
        previousMillis = currentMillis;  
        if( ledA == OFF )
        {
          ledA = ON;
          ledB = OFF;
        }
        else
        {
          ledB = ON;
          ledA = OFF;
        }
        
        digitalWrite(anode, ledA);
        digitalWrite(anode2, ledB);
        digitalWrite(cathode, LOW);  
        }
    }
    VIDEO PROOF

    0 Not allowed! Not allowed!
    Last edited by PvtRyan; 09-28-2013 at 04:03 PM.


    PS4 Profile:

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 01:56 PM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.