hello!
I need some help, I've played around with relays before with Arduino but now I need the relay to stay on for say, 10 seconds after the button is pushed and then have the relay turn off. I want to integrate this with my 128x64 OLED display, I want it to say "relay on" when the button is pressed, then after that it will go back to a waiting screen
here is my code for the waiting screen:
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
// OLED display TWI address
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(-1);
#if (SSD1306_LCDHEIGHT != 64)
#endif
void setup() {
// initialize and clear display
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
display.display();
}
void loop() {
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,0.9);
display.print("Waiting");
display.display();
delay(1000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,0.9);
display.print("Waiting.");
display.display();
delay(1000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,0.9);
display.print("Waiting..");
display.display();
delay(1000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,0.9);
display.print("Waiting...");
display.display();
delay(1000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,0.9);
display.print("Waiting....");
display.display();
delay(1000);
display.clearDisplay();
}
i need help with the relay code and actually integrating the two.
but the thing is all I need is the relay code that triggers with the push of a button and then I need my waiting screen code changed so that when I push a button it will display the "relay on" for 10 seconds.
I know how to have one button trigger two arduinos, so im using a nano to control the screen and an uno for the rest of the project.
I want them separate because this is part of a bigger project and the screen code has tons of delays in it so I don't want that conflicting with the rest of the project