const int ledPin = LED_BUILTIN;
int ledState = LOW;
unsigned long previousMillis1 = 0;
unsigned long previousMillis2 = 0;
const long interval1 = 100;
const long interval2 = 700;
const int buzz = 9;
#include <pitches.h>
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
unsigned long currentMillis1 = millis();
if (currentMillis1 - previousMillis1 >= interval1) {
previousMillis1 = currentMillis1;
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
}
digitalWrite(LED_BUILTIN, ledState);
unsigned long currentMillis2 = millis();
if (currentMillis2 - previousMillis2 >= interval2) {
previousMillis2 = currentMillis2;
tone(buzz, 300, 345);
}
}