An output device is any peripheral that receives data from a Microcontroller, usually for display, projection, or physical reproduction.
On this week i try to make RGB led as my Output device in order to complete my Assignment.
On circuit board i try to design both schematic and ciruit board by using eagle software in order to complete my assignment.
On my ciruit there is no input device needed. i try to connect both RGB LED pins and attiny45 pins in order to make full circuit.Between RGB pins and Attiny45 pins there is resistor of 500 ohms in to protect RGB LED.
On my circuit design i try connect all pins of RGB LED on Attiny45 because i supposed to use all three color to be ON.But green pin it doesn't work.
RGB LED means red, blue and green LEDs. RGB LED products combine these three colors to produce over 16 million hues of light. ... Some colors are “outside” the triangle formed by the RGB LEDs. Also, pigment colors such as brown or pink are difficult, or impossible, to achieve.
In fact, an RGB LED is a combination of 3 LEDs in just one package:
With an RGB LED you can produce almost any color. How is this possible with just one single LED?
The color produced by the RGB LED is a combination of the colors of each one of these three LEDs. An RGB LED looks like this:
On this pinout you have seen there is two kind of RGB one is common cathode other is common anode
On common cathode you can put common pin on ground(GND) other pins goes on microcontroller pins.
On common anode is where you can connect common pin on Vcc and other goes to microcontroller pins. Actually on my circuit board i use common anode.
First i declare all pins which will be connected on Attiny45 and also time delay.
Second i put all output pins i was declared in void setup in order if it is input or output.
Last thing i try to make code which is run the RGB LED in continously.
const int redPin = 2; //const int grnPin = 1; const int bluPin = 0; int del = 500; // delay void setup(){ // Setup for outputs pinMode(redPin, OUTPUT); //pinMode(grnPin, OUTPUT); pinMode(bluPin, OUTPUT); digitalWrite(redPin, HIGH); digitalWrite(bluPin, HIGH); //digitalWrite(grnPin, HIGH); } void loop() { // Loop for fading digitalWrite(redPin, LOW); delay(del); digitalWrite(redPin, HIGH); delay(del/2); digitalWrite(bluPin, LOW); delay(del); digitalWrite(bluPin, HIGH); delay(del/2); //digitalWrite(grnPin, LOW); delay(del); //digitalWrite(grnPin, HIGH); delay(del/2); digitalWrite(redPin, LOW); digitalWrite(bluPin, LOW); //digitalWrite(grnPin, LOW); delay(del); digitalWrite(redPin, HIGH); digitalWrite(bluPin, HIGH); //digitalWrite(grnPin, HIGH); delay(del/2); }
Here you can download all file on this week Download the files here