LED Never Breathes! MacBook Pro Has Sleep LED Which Pulsates Resembling Human Breathing. Here is Breathing LED Arduino Circuit & Code. Circuit sketch not required. If you can add LED to default BLINK sketch to blink, you can easily use it. It will need only one LED, optionally, you can use a resister for better voltage control. It is suggested to use a resister. Adafruit has a cufflink named iCufflinks which costs $128.00 for a pair (what???). So peoples changed the code a bit to make it working on Arduino UNO or practically any Arduino. We will post later how to make those kind of cufflinks pair at lesser than $1.28. Coding, testing is the main part. Just a hints – fiber optic cable does the work from a Arduino UNO in your wallet, it may be impractical, so practical way also said later in this article.
Breathing LED Arduino : Circuit
Add that LED on Pin 11 and GND. Do not try to alter the code to make it working for Pin 13, it actually demands good knowledge on C++. Here is a crap quality video from our side to show you how actually the thing breathes :
for a basic testing, who will use a high end camera. Here is how human breathes :
---
It is actually not so easy to create that effect. Apple has patent :
1 | http://www.google.co.in/patents/US6658577 |
The included sketch named Fade demonstrates the use of the analogWrite()
function in fading an LED off and on. analogWrite()
uses pulse width modulation (PWM), turning a digital pin on and off very quickly, to create a fading effect.
Breathing LED Arduino : Code
Whatever they charge money, we can create the effect with Arduino and an LED completely free of cost :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | // Distributed under GNU GPL 3.0 int i = 0; void setup() { for(i = 0 ; i <= 15; i+=1) { analogWrite(11, i); delay(5); } } void loop() { for(i = 15 ; i <= 255; i+=1) { analogWrite(11, i); if (i > 150) { delay(4); } if ((i > 125) && (i < 151)) { delay(5); } if (( i > 100) && (i < 126)) { delay(7); } if (( i > 75) && (i < 101)) { delay(10); } if (( i > 50) && (i < 76)) { delay(14); } if (( i > 25) && (i < 51)) { delay(18); } if (( i > 1) && (i < 26)) { delay(19); } } for(i = 255; i >=15; i-=1) { analogWrite(11, i); if (i > 150) { delay(4); } if ((i > 125) && (i < 151)) { delay(5); } if (( i > 100) && (i < 126)) { delay(7); } if (( i > 75) && (i < 101)) { delay(10); } if (( i > 50) && (i < 76)) { delay(14); } if (( i > 25) && (i < 51)) { delay(18); } if (( i > 1) && (i < 26)) { delay(19); } } delay(970); } |
You can see in video, it is quite nicely working on Arduino UNO R3.
Breathing LED Without Arduino : Circuit & Code
Yes, it is possible to make breathing LED without Arduino. For that you’ll need this stuffs which are shown in circuit diagram :
Actually, very small ready to use circuits are available at $4 or something like that for getting that effect. This is really practical for creating breathing LED for your iCufflinks. Not always we need coding.
Tagged With breathing led arduino code , breathing led code , heart breathing coding for uno r3 , arduino breathing led , breathing led code c , arduino breathing , what is breath in arduino coding , arduino breathing light code , arduino breathing light , arduino breathing effect