// Timing of 4 things, starting 40ms after each other, staying active 140ms.
//
// Forum: https://forum.arduino.cc/t/asking-questions-for-i2c-channel-communication/1186203/16
// This Wokwi project: https://wokwi.com/projects/380693069509691393
//
// I can think of 4 good solutions.
// This is with delays.
// The code will do that sequence at the press of a button.
const int buttonPin = 2;
void setup()
{
pinMode(buttonPin, INPUT_PULLUP);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}
void loop()
{
int button = digitalRead(buttonPin);
if(button == LOW)
{
digitalWrite(4, HIGH);
delay(40);
digitalWrite(5, HIGH);
delay(40);
digitalWrite(6, HIGH);
delay(40);
digitalWrite(7, HIGH);
delay(20);
digitalWrite(4, LOW);
delay(40);
digitalWrite(5, LOW);
delay(40);
digitalWrite(6, LOW);
delay(40);
digitalWrite(7, LOW);
}
}