[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Introduction” tab_id=”1394073451-1-88″][vc_column_text]Breathing light is a status light really, also used for notification if a new message arrives or perhaps if you missed a phone call. you might want to consider turning it off if you are concerned with battery life as it does use a bit more, tho i am not sure if it is that significant.
I have published a post about breathing light- using arduino board, but use on pcduino ,need some modification.
[/vc_column_text][/vc_tab][vc_tab title=”Source code” tab_id=”1394073451-2-77″][vc_column_text]/ * Note do not operate pcduino after starting the program , otherwise there may be a clear sense of light flashes * /
#
include
"core.h"
#define SigPin
2
#define CYCLE
1500
void
delay_us(
int
t)
{
usleep(t);
}
void
delay_ms(
int
t)
{
while
(--t){usleep(
1000
);}
}
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]
Leave a Reply
You must be logged in to post a comment.