Arduino - millis() in tamil
arduino with 2 led blink using millis
int period = 2000;
unsigned long time_now = 0;
unsigned long time_now2 = 0;
int led_state1 = false;
int led_state2 = false;
void setup() {
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop() {
if(millis() > time_now + period){
time_now = millis();
led_state1 = !led_state1;
digitalWrite(13,led_state1);
}
if(millis() > time_now2 + 1000){
time_now2 = millis();
led_state2 = !led_state2;
digitalWrite(12,led_state2);
}
}
Comments
Post a Comment