Monday, 22 September 2014

Tree valves optical




Today we will see how to create a tree of valves optical easy to make continued subject.

The first step:
Provision of supplies:
- Microcontrollers (Microcntroller) of type AT tiny85 
- Electric bus (wire electric) 
- A package of valves optical (LED)
- Arduino card for programming microcontrollers AT tiny85 
 For more information about the card >>>>>>> Arduino (  Arduino know the card and the most Important advantages )  



The second step:
- Programmable microcontrollers AT tiny85 Using Arduino card 
- Follow link scheme 



- And then binds to the Arduino card with the computer, and slide the following code for microcontrollers AT tiny85 
  Of course, the special program thru Arduino card you can download it from  here .  

Own code Balmicrockntrulr
 ________________________________
// CODE STARTS HERE

// ATtiny85 RGB color fading tree  

const int 2Pin = 2;   
const int 1Pin = 1;   
const int 0Pin = 0;  


void setup ()  
{  
  PinMode (2Pin, OUTPUT);      
  PinMode (1Pin, OUTPUT);      
  PinMode (0Pin, OUTPUT) ;  

}  

void loop () {  
    2to21 ();  
    21to1 ();  
    1to10 ();  
    10to0 ();  
    0to02 ();  
    02to2 ();  
  }  

void 2to21 ()  
{  
  DigitalWrite (RedPin, HIGH);  
  DigitalWrite (BluPin, LOW) ;  

  // fade up green  
  for (byte i = 1; i <100; i ++) {  
    byte on = i;  
    = 100 byte off-on;  
    for (a byte = 0; a <100; ++ a) {  
      DigitalWrite (GrnPin, HIGH);  
      DelayMicroseconds (on);  
      DigitalWrite (GrnPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  



void 21to1 ()  
{  
  DigitalWrite (GrnPin, HIGH);  
  DigitalWrite (BluPin, LOW);  

  // fade down red  
  for (byte i = 1; i <100; i ++) {  
    byte on-i = 100;  
    byte off = i;  
    for (a byte = 0; a <100; ++ a) {  
      DigitalWrite (RedPin, HIGH );  
      DelayMicroseconds (on);  
      DigitalWrite (RedPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  


void 1to10 ()  
{  
  DigitalWrite (GrnPin, HIGH);  
  DigitalWrite (RedPin, LOW);  

  // fade up blue  
  for (byte i = 1; i <100; i ++) {  
    byte on = i;  
    = 100 byte off-on;  
    for (a byte = 0; a <100; ++ a) {  
      DigitalWrite (BluPin, HIGH);  
      DelayMicroseconds (on );  
      DigitalWrite (BluPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  



void 10to0 ()  
{  
  DigitalWrite (BluPin, HIGH);  
  DigitalWrite (RedPin, LOW);  

  // fade down green  
  for (i = 1 byte;  i < 100;  ++ i) {  
    byte on-i = 100;  
    byte off = i;  
    for (a byte = 0; a <100; a ++) {  
      DigitalWrite (GrnPin, HIGH);  
      DelayMicroseconds (on);  
      DigitalWrite (GrnPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  


void 0to02 ()  
{  
  DigitalWrite (BluPin, HIGH);  
  DigitalWrite (GrnPin, LOW) ;  

  // fade up red  
  for (byte i = 1; i <100; i ++) {  
    byte on = i;  
    = 100 byte off-on;  
    for (a byte = 0; a <100; ++ a) {  
      DigitalWrite (RedPin, HIGH);  
      DelayMicroseconds (on);  
      DigitalWrite (RedPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  



void 02to2 ()  
{  
  DigitalWrite (RedPin, HIGH);  
  DigitalWrite (GrnPin, LOW);  

  // fade down blue  
  for (byte i = 1; i <100; i ++) {  
    byte on-i = 100;  
    byte off = i;  
    for (a byte = 0; a <100; ++ a) {  
      DigitalWrite (BluPin, HIGH );  
      DelayMicroseconds (on);  
      DigitalWrite (BluPin, LOW);  
      DelayMicroseconds (off);  
    }  
  }  
}  

// CODE ENDS HERE
                              _____________________________________ 

The third step:
Unplug the optical fuse into three groups, each group containing three light valves.
Ptlhim your 3-legged Anode for optical valves together and 3-legged Cathode valves optical together.
(For example, choosing the black thread and thread represents Cathode Blue represents Anode).



You can add pins at the end of the thread when welding for easier installation in the board.

Step Four:
Connect the Anode in 3 sets of 0,1,2-legged Macairokntrulr AT tiny85
And put the one common thread of Cathode in GND) Ground) 

The man then Ptousel 4 (GND) for Mcrockntrulr with the man in the negative battery (3 volts 2xAA)
 The man's 8 (VCC) man the battery positive +3 volts.




Note: Do not to use resistors because AT tiny85 would not have had enough to light the lamps 

0 التعليقات:

Post a Comment