DF ROBOT keypad shield use. Programming question

Hi everyone.

I would like ask, as I am completely new to arduino.
I do use 4 relay board to control photo equipment.
I am thinking of adding display shield to be able of controlling relays on and of delays times without connection of my laptop.

So my question is simple. Is it possible at all?
If yes, can someone help me with code?
I do mark delay which I want to control by buttons on display shield with :"<----"

My sketch:

#define PIN_RELAY_1 2 // the Arduino pin, which connects to the IN1 pin of relay module
#define PIN_RELAY_2 3 // the Arduino pin, which connects to the IN2 pin of relay module
#define PIN_RELAY_3 4 // the Arduino pin, which connects to the IN3 pin of relay module
#define PIN_RELAY_4 5 // the Arduino pin, which connects to the IN4 pin of relay module
#define BUTTON_PIN 8
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(9600);

// initialize digital pin as an output.
pinMode(PIN_RELAY_1, OUTPUT);
pinMode(PIN_RELAY_2, OUTPUT);
pinMode(PIN_RELAY_3, OUTPUT);
pinMode(PIN_RELAY_4, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}

// the loop function runs over and over again forever
void loop()
{
byte buttonState = digitalRead(BUTTON_PIN);

if (buttonState == LOW) {
delay(500);
digitalWrite(PIN_RELAY_1, LOW);digitalWrite(PIN_RELAY_4, HIGH);
delay(70); <----
digitalWrite(PIN_RELAY_1, HIGH);
delay(65); <----
digitalWrite(PIN_RELAY_1, LOW);
delay(70); <----
digitalWrite(PIN_RELAY_1, HIGH);
delay(118); <----
digitalWrite(PIN_RELAY_2, HIGH);
delay(100);
digitalWrite(PIN_RELAY_2, LOW); digitalWrite(PIN_RELAY_4, LOW);
delay(100);
}
else {
Serial.println("Button is not pressed");
}}

Many thanks for any help.

Arkadiusz Sibilski

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

YES

that someone will be you for the most part. we'll contribute to the solution but you need to get going

  • how will you enter the information? (keypad?)
  • what screen are you looking at? (I2C LCD 1602?)

whatever you choose, start playing with those elements until you understand how exactly they can be put to good use. for example write a small program recording a number from the keypad, may be validated by the '#' key and print that out to the Serial monitor.

then use the LCD instead of the Serial monitor

then start to integrate everything together

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.