• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoSmall program of Breathing Lamp on Arduino
Previous Next

Small program of Breathing Lamp on Arduino

Posted by: admin , March 6, 2014

[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Introduce” tab_id=”1393987000-1-88″][vc_column_text]Breathing lamp refers to the lights that complete gradual change from light to dark

under the control of a microcomputer or circuit , feeling like breathing.

It is Widely used in mobile phones and become one of the selling points of new phones

at each big brand .

If your phone has a pending notification, such as missed calls, unchecked messages

and so on, breathing lamp will change from dark to bright, the rhythm     is  just   like

breathing , and it plays a role of notice to remind.

QQ图片20140304215812

[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1393987000-2-24″][vc_column_text]

#include"arduino.h"
#include <util/delay.h>

#define SigPin 2

#define CYCLE 1500

void setup() {
  // put your setup code here, to run once:
  pinMode(SigPin,OUTPUT);
  digitalWrite(SigPin,LOW);

}

void loop() {
  int count;
  // put your main code here, to run repeatedly: 
  digitalWrite(SigPin,LOW);
  _delay_ms(600); 
  for(count=1;count<CYCLE;count++)
  {

     digitalWrite(SigPin,HIGH);
     _delay_us(count);
     digitalWrite(SigPin,LOW);
     _delay_us(CYCLE-count);
  }
  digitalWrite(SigPin,HIGH);
  for(count=CYCLE-1;count>0;count--)
  {
    digitalWrite(SigPin,HIGH);
    _delay_us(count);
    digitalWrite(SigPin,LOW);
   _delay_us(CYCLE-count);
  }
  _delay_ms(600);
}

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Arduino

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors