//Created by Barbu Vulc!
/*This was a recent college miniproject with the purpose
of demonstrating a highly used concept: „concurrent programming”!
*/
unsigned long start = 0;
unsigned long LED1_prev = 0;
unsigned long LED1_int = 1000; //Blink 1 second!
unsigned long LED2_prev = 0;
unsigned long LED2_int = 250; //Blink 250 milliseconds!
#define LED1 8
#define LED2 10
int LED1_state = 0;
int LED2_state = 0;
void setup(){
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
//LEDs will blink according to their assigned blinking interval!
void loop(){
//„millis()” function...
start = millis();
if(start - LED1_prev > LED1_int){
LED1_prev = start;
LED1_state = !LED1_state;
digitalWrite(LED1, LED1_state);
}
if(start - LED2_prev > LED2_int){
LED2_prev = start;
LED2_state = !LED2_state;
digitalWrite(LED2, LED2_state);
}
}