Created
October 25, 2019 15:48
-
-
Save SCI-COPATH/d439922d08e15798c7e25856ebd409c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define led_pin 11 | |
void analog(int pin,float dig) | |
{ | |
int an=dig*51; | |
analogWrite(pin,an); | |
} | |
float atod(float Dig) | |
{ | |
float res=51*Dig; | |
return res; | |
} | |
void light (int pin,int Time) | |
{ | |
int i; | |
for(i=0;i<153;i++) | |
{ | |
delay(Time); | |
analogWrite(pin,i); | |
} | |
for( ;i>=0;i--) | |
{ | |
delay(Time); | |
analogWrite(pin,i); | |
} | |
} | |
void setup() { | |
pinMode(led_pin,OUTPUT); | |
} | |
void loop() { | |
light (led_pin,6); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment