In this example we will connect an RGB led to a Digispark, a quick recap of the basic Digispark we ware using in this example
XGHF-GY Digispark Kickstarter Miniature Development Board TINY85 – Blue – $4.65 The Digispark is an Attiny85 based microcontroller development board similar to the Arduino line only cheaper smaller and a bit less powerful. With a whole host of shields to extend its functionality and the ability to use the familiar Arduino IDE the Digispark is a great way to jump into electronics or perfect for when an Arduino is too big or too much. The Digispark is shipped fully assembled except for the two included and easy to solder headers. Here are the specs: Support for the Arduino IDE 1.0+ (OSX/Win/Linux) Power via USB or External Source – 5v or 7-35v (12v or less recommended automatic selection) |
Schematics
Here are some schematics and a breadboard layout
Here is the breadboard layout
Code
[codesyntax lang=”cpp”]
#define redpin 1 #define greenpin 2 #define bluepin 3 void setup() { // initialize the digital pin as an output. pinMode(redpin, OUTPUT); pinMode(greenpin, OUTPUT); pinMode(bluepin, OUTPUT); // Set high for common anode type digitalWrite(redpin, HIGH); digitalWrite(greenpin, HIGH); digitalWrite(bluepin, HIGH); } void loop() { digitalWrite(redpin, LOW); //red on delay(500); digitalWrite(redpin, HIGH); //red off digitalWrite(greenpin, LOW); //green on delay(500); digitalWrite(greenpin, HIGH); //green off digitalWrite(bluepin, LOW); //blue on delay(500); digitalWrite(bluepin, HIGH); //blue off }
[/codesyntax]
Links
XGHF-GY Digispark Kickstarter Miniature Development Board TINY85 – Blue
USB Interface Digispark Kickstarter ATTINY85 Development Board – Black