# Help me code this funtion

**URL:** <https://forum.arduino.cc/t/help-me-code-this-funtion/886280>\
**Category:** Programming\
**Created:** [July 17, 2021, 8:31pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280 "2021-07-17T20:31:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:31pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/1 "2021-07-17T20:31:39Z")

</div>

Hi...i made a project on staircase automatic lights with ir sensors  
as the person climbs from 1st step sensor 1 triggers lights and as he moves to last step sensor 2 triggers and turns off the lights.  
the point where i need help me, if the person walks and triggers the sensor 1 but dosnt go all way up rather gets back..soo he dosnt trigger sensor 2 which makes lights to glow forever  
so i want to set a timer like..if sensor 1 is triggers and sensor 2 is not triggers for the specific time , turn off all lights(relays).  
i tried millis but fell more complicated for me. can anyone help me get this done?  
my code

```cpp
#include <EEPROM.h> //We need this library
#include <Arduino.h> // for type definitions

int timex=1000;
//int potpin = A3;
#define button 8 //Push button on D8

int step1=2;
int step2=3;
int step3=4;

int lowerin=0;
int upperin=0;
//int lowerout=0;
//int upperout=0;

int lowerstep=14;
int upperstep=19;

int state = 0; //integer to hold current state
int old = 0; //integer to hold last state
int buttonpoll = 0; //integer to hold button state

void toupon(){

  digitalWrite(step1,HIGH);delay(timex);Serial.print(" step 1 on ");
  digitalWrite(step2,HIGH);delay(timex);Serial.print(" step 2 on ");
  digitalWrite(step3,HIGH);delay(timex);Serial.print(" step 3 on ");
  
}

void toupoff(){

  digitalWrite(step1,LOW);delay(timex);Serial.print(" step 1 off ");
  digitalWrite(step2,LOW);delay(timex);Serial.print(" step 2 off ");
  digitalWrite(step3,LOW);delay(timex);Serial.print(" step 3 off ");
  
}

void todownon(){

  digitalWrite(step3,HIGH);delay(timex);Serial.print(" step 3 on ");
  digitalWrite(step2,HIGH);delay(timex);Serial.print(" step 2 on ");
  digitalWrite(step1,HIGH);delay(timex);Serial.print(" step 1 on ");
}

void todownoff(){

  digitalWrite(step3,LOW);delay(timex);Serial.print(" step 3 off ");
  digitalWrite(step2,LOW);delay(timex);Serial.print(" step 2 off ");
  digitalWrite(step1,LOW);delay(timex);Serial.print(" step 1 off ");
}

void setup() {

  Serial.begin(9600);
  Serial.println(" Staircase System Ready ");
    pinMode(lowerstep,INPUT);
    pinMode(upperstep,INPUT);
    digitalWrite(lowerstep,HIGH);
    digitalWrite(upperstep,HIGH);
  
    pinMode(step1,OUTPUT);
    pinMode(step2,OUTPUT);
    pinMode(step3,OUTPUT);
    pinMode(button, INPUT);  
    
    state = EEPROM.read(0);
}

void loop() {
  
  buttonRead();
  switchDecision();
  dataWriteLongTerm();
}

void buttonRead() 
 {//debouncing routine to read button
  buttonpoll = digitalRead(button); //poll the state of button
  if (buttonpoll == 1) { //check if it has been pressed
    delay(50); //wait 50ms
    buttonpoll = digitalRead(button); //poll button again
    if (buttonpoll == 0) { //if it is 0 considered one press
      state = old + 1;    
    }
  }
   else { //if button has not been pressed
    delay(100); // wait 100ms
   }
 }

void switchDecision() {
  int lower=digitalRead(lowerstep);
  int upper=digitalRead(upperstep);

   switch(state){
    
    case 1:
      digitalWrite(step1,HIGH);
      digitalWrite(step2,HIGH);
      digitalWrite(step3,LOW);{Serial.println(" 1 AND 2 steps ON ");}
      old = state;
      break;
      
      
     case 2:
      digitalWrite(step1,HIGH);
      digitalWrite(step2,HIGH);
      digitalWrite(step3,HIGH);{Serial.println(" All steps ON ");}
      old = state;
      break;

     case 3:
      digitalWrite(step1,HIGH);
      digitalWrite(step2,LOW);
      digitalWrite(step3,HIGH);{Serial.println(" 1 and 3 steps ON ");}
      old = state;
      break;

     case 4:
      
      digitalWrite(step1,LOW);
      digitalWrite(step2,LOW);
      digitalWrite(step3,LOW);{Serial.println(" All steps OFF ");}
      old = state;
      break;

      default:
      {Serial.print( " SENSORS ACTIVATED ");}
      if ( lower==LOW && upperin==0 ){Serial.println(" Moving up "); toupon();lowerin=1; } //turns ON light from 1st step to last
      if ( lower==LOW && upperin==1 ){Serial.println(" closing down "); todownoff();upperin=0;} //turns OFF light from last step to 1st
      if ( upper==LOW && lowerin==0 ){Serial.println(" Moving down "); todownon();upperin=1 ;} //turns ON light from last step to 1st
      if ( upper==LOW && lowerin==1 ){Serial.println(" closing up "); toupoff();lowerin=0;} //turns OFF light from 1st step to last
      old = 0;
      break;
   }
 }   
void dataWriteLongTerm() {
  EEPROM.write(0, state);
  
}

```

this is the part which requires changes i guess

````cpp
      if ( lower==LOW && upperin==0 ){Serial.println(" Moving up "); toupon();lowerin=1; } //turns ON light from 1st step to last
      if ( lower==LOW && upperin==1 ){Serial.println(" closing down "); todownoff();upperin=0;} //turns OFF light from last step to 1st
      if ( upper==LOW && lowerin==0 ){Serial.println(" Moving down "); todownon();upperin=1 ;} //turns ON light from last step to 1st
      if ( upper==LOW && lowerin==1 ){Serial.println(" closing up "); toupoff();lowerin=0;} //turns OFF light from 1st step to last```
````

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [July 17, 2021, 8:36pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/2 "2021-07-17T20:36:17Z")

</div>

Duplicate, awaiting merge

---

<div class="post-metadata">

**Author:** ![anon46966594](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@anon46966594](https://forum.arduino.cc/u/anon46966594)\
**Post date:** [July 17, 2021, 8:38pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/3 "2021-07-17T20:38:27Z")

</div>

Why a timer? Why don't you just have trigger one and trigger two both toggling a single boolean for the lights?

That way if a person goes up the lights trigger and if they get half way and come back down passed sensor 1 again they turn back off

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:38pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/4 "2021-07-17T20:38:32Z")

</div>

this is different....i added soo many stuffs here

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:40pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/5 "2021-07-17T20:40:04Z")

</div>

this sounds cool but dosnt work in practical use as...one person goes up and other comes back of him end up trigger off lights...soo timer is a better alternative

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [July 17, 2021, 8:43pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/6 "2021-07-17T20:43:06Z")

</div>

> [@boopesh\_boo](#):
>
> this is different....i added soo many stuffs here

It looks to me like you took a lot of stuff away, but "toupon" and "toupoff" still look pretty similar to me.

---

<div class="post-metadata">

**Author:** ![anon46966594](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@anon46966594](https://forum.arduino.cc/u/anon46966594)\
**Post date:** [July 17, 2021, 8:44pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/7 "2021-07-17T20:44:29Z")

</div>

You have the same issue in reverse already though. Say one person starts going up the stairs (triggering the lights on), immediately after someone comes down the stairs and triggers sensor 2 plunging them both into darkness.

Unless you just let any time either trigger is set off to keep the lights on for a further 1min (or however long seems acceptable to scale the stairs) then turn off again

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:44pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/8 "2021-07-17T20:44:31Z")

</div>

uh its the same project and almost i finished it..execpt for that one funtion, can you help me code that please

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:49pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/9 "2021-07-17T20:49:30Z")

</div>

this happens very rare in my  
Say one person starts going up the stairs (triggering the lights on), immediately after someone comes down the stairs and triggers sensor 2 plunging them both into darkness.

but your idea makes sense to me. it would work great if i use 4 ir sensors  
and set up people count.but as im a beginner ..it feels like fantasy to me

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [July 17, 2021, 8:51pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/10 "2021-07-17T20:51:54Z")

</div>

> [@boopesh\_boo](#):
>
> …plunging them both into darkness.

LOL.

Sry, it really is quite amusing thinking of all the ways this can go wrong.

a7

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:52pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/11 "2021-07-17T20:52:47Z")

</div>

uh yeah ..best one would be adding 4 ir sensors and making people count

---

<div class="post-metadata">

**Author:** ![anon46966594](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@anon46966594](https://forum.arduino.cc/u/anon46966594)\
**Post date:** [July 17, 2021, 8:55pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/12 "2021-07-17T20:55:23Z")

</div>

The best idea is probably just to install a switch at the top and bottom of the staircase and ask the residents to kindly turn the light back off again if they are the last person on the staircase and are no longer using it?

---

<div class="post-metadata">

**Author:** ![anon46966594](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@anon46966594](https://forum.arduino.cc/u/anon46966594)\
**Post date:** [July 17, 2021, 8:56pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/13 "2021-07-17T20:56:37Z")

</div>

I've been in public restrooms before with motion sensor lights and they turn off mid-poop if you take too long. Trying to clean up is fun!

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:57pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/14 "2021-07-17T20:57:02Z")

</div>

lol then whats the point of making all this dude?

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 17, 2021, 8:57pm UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/15 "2021-07-17T20:57:16Z")

</div>

thats pir

---

<div class="post-metadata">

**Author:** ![boopesh\_boo](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@boopesh\_boo](https://forum.arduino.cc/u/boopesh_boo)\
**Post date:** [July 15, 2021, 6:54am UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/16 "2021-07-15T06:54:17Z")

</div>

hi i want to merge this codes. one is ir automatic stiarcase light which uses relays that are directly connected to arduino nano digital pins. but i want to use shift register to connect those relays.  
Can anyone help me fix this ?

**STAIRCASE IR SENSOR CODE:**

```cpp
int timex=1000;
int potpin = A3;

int step1=2;
int step2=3;
int step3=4;
int step4=5;
int step5=6;
int step6=7;
int step7=8;
int step8=9;

int lowerin=0;
int upperin=0;
int lowerout=0;
int upperout=0;

int lowerstep=14;
int upperstep=19;

void toupon(){

 digitalWrite(step1,LOW);delay(timex);Serial.print(" step 1 on");
 digitalWrite(step2,LOW);delay(timex);Serial.print(" step 2 on");
 digitalWrite(step3,LOW);delay(timex);Serial.print(" step 3 on"); 
 digitalWrite(step4,LOW);delay(timex);Serial.print(" step 4 on");
 digitalWrite(step5,LOW);delay(timex);Serial.print(" step 5 on");
 digitalWrite(step6,LOW);delay(timex);Serial.print(" step 6 on"); 
 digitalWrite(step7,LOW);delay(timex);Serial.print(" step 7 on");
 digitalWrite(step8,LOW);delay(timex);Serial.print(" step 8 on");
 }

void toupoff(){

 digitalWrite(step1,HIGH);delay(timex);Serial.print(" step 1 OFF");
 digitalWrite(step2,HIGH);delay(timex);Serial.print(" step 2 OFF");
 digitalWrite(step3,HIGH);delay(timex);Serial.print(" step 3 OFF");
 digitalWrite(step4,HIGH);delay(timex);Serial.print(" step 4 OFF");
 digitalWrite(step5,HIGH);delay(timex);Serial.print(" step 5 OFF");
 digitalWrite(step6,HIGH);delay(timex);Serial.print(" step 6 OFF");
 digitalWrite(step7,HIGH);delay(timex);Serial.print(" step 7 OFF");
 digitalWrite(step8,HIGH);delay(timex);Serial.print(" step 8 OFF");
}
void todownon(){

 digitalWrite(step8,LOW);delay(timex);Serial.print(" step 8 on");
 digitalWrite(step7,LOW);delay(timex);Serial.print(" step 7 on");
 digitalWrite(step6,LOW);delay(timex);Serial.print(" step 6 on");
 digitalWrite(step5,LOW);delay(timex);Serial.print(" step 5 on");
 digitalWrite(step4,LOW);delay(timex);Serial.print(" step 4 on");
 digitalWrite(step3,LOW);delay(timex);Serial.print(" step 3 on");
 digitalWrite(step2,LOW);delay(timex);Serial.print(" step 2 on");
 digitalWrite(step1,LOW);delay(timex);Serial.print(" step 1 on");
  }

void todownoff(){

 digitalWrite(step8,HIGH);delay(timex);Serial.print(" step 8 OFF");
 digitalWrite(step7,HIGH);delay(timex);Serial.print(" step 7 OFF");
 digitalWrite(step6,HIGH);delay(timex);Serial.print(" step 6 OFF");
 digitalWrite(step5,HIGH);delay(timex);Serial.print(" step 5 OFF");
 digitalWrite(step4,HIGH);delay(timex);Serial.print(" step 4 OFF");
 digitalWrite(step3,HIGH);delay(timex);Serial.print(" step 3 OFF");
 digitalWrite(step2,HIGH);delay(timex);Serial.print(" step 2 OFF");
 digitalWrite(step1,HIGH);delay(timex);Serial.println(" step 1 OFF");}

void setup() {
Serial.begin(9600);
Serial.println("StairCase System Ready");
 pinMode(lowerstep,INPUT);
 pinMode(upperstep,INPUT);
 digitalWrite(lowerstep,HIGH);
 digitalWrite(upperstep,HIGH);

 pinMode(step1,OUTPUT);
 pinMode(step2,OUTPUT);
 pinMode(step3,OUTPUT);
 pinMode(step4,OUTPUT);
 pinMode(step5,OUTPUT);
 pinMode(step6,OUTPUT);
 pinMode(step7,OUTPUT);
 pinMode(step8,OUTPUT);  
}

void loop() {

Serial.println(timex);
int lower=digitalRead(lowerstep);
int upper=digitalRead(upperstep);

if (lower==LOW && upperin==0 ){Serial.println(" Moving up "); toupon(); lowerin;}
if (lower==LOW && upperin==1 ){Serial.println(" closing down"); todownoff(); upperin;}
if (lower==LOW && upperin==0 ){Serial.println(" Moving down ");todownon(); upperout;}
if (lower==LOW && upperin==1 ){Serial.println(" closing up "); toupoff();lowerout;}
}

```

**SHIFT REGISTER IC CODE**

```cpp
int DS1_pin = 16; // data pin A2
int STCP1_pin =15; // Latch A1
int SHCP1_pin = 14 ; // Clock A0

int digits [17][16]{
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//0
  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//1
  {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//2
  {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0},//3
  {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0},//4
  {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0},//5
  {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0},//6
  {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0},//7
  {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},//8
  {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},//9
  {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0},//10
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},//11
  {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},//12
  {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},//13
  {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},//14
  {1,0,1,0,1,1,1,1,1,0,1,0,1,0,0,0},//15
  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}// 16

  /* {0,1,1,1,1,1,1,0}, // digit 0
  {0,0,1,1,0,0,0,0}, // digit 1
  {0,1,1,0,1,1,0,1}, // digit 2
  {0,1,1,1,1,0,0,1}, // digit 3
  {0,0,1,1,0,0,1,1}, // digit 4
  {0,1,0,1,1,0,1,1}, // digit 5
  {0,1,0,1,1,1,1,1}, // digit 6
  {0,1,1,1,0,0,0,0}, // digit 7
  {0,1,1,1,1,1,1,1}, // digit 8
  {0,1,1,1,1,0,1,1}, // digit 9*/
};

void display_digit(int d) {
  if (digits[d][0]==1){} //A
  if (digits[d][1]==1){} //B
  if (digits[d][2]==1){} //C
  if (digits[d][3]==1){} //D
  if (digits[d][4]==1){} //E
  if (digits[d][5]==1){} //F
  if (digits[d][6]==1){} //G
}

void DisplayDigit(int Digit)
{
    digitalWrite(STCP1_pin,LOW);
    for (int i = 16; i>=0; i--)
    {
      digitalWrite(STCP1_pin,LOW);
      if (digits[Digit][i]==1) digitalWrite(DS1_pin, HIGH);
      if (digits[Digit][i]==0) digitalWrite(DS1_pin, LOW);
      digitalWrite(SHCP1_pin,HIGH);
    }
      digitalWrite(STCP1_pin,HIGH);
}

void setup() {
  pinMode(DS1_pin, OUTPUT);
  pinMode(STCP1_pin, OUTPUT);
  pinMode(SHCP1_pin, OUTPUT);
}

void loop() {

  DisplayDigit (0);
  
}

```

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [July 15, 2021, 6:58am UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/17 "2021-07-15T06:58:48Z")

</div>

Hello  
Take a view here.

> **[How to Use a Shift Register - Arduino Tutorial](https://www.instructables.com/How-to-use-a-Shift-Register-Arduino-Tutorial/)**
>
> How to Use a Shift Register - Arduino Tutorial: In this tutorial you will learn how to use a shift register (or serial to paralled controller). The shift register will give to your Arduino an additional 8 digital outputs, by using only 3 pins on your...

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [July 15, 2021, 7:01am UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/18 "2021-07-15T07:01:58Z")

</div>

You'll want to read [this](https://www.arduino.cc/reference/en/language/variables/data-types/array/) too.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [July 15, 2021, 7:18am UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/19 "2021-07-15T07:18:50Z")

</div>

@boopesh_boo

Other post/duplicate DELETED  
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to [Learn How To Use The Forum](https://forum.arduino.cc/index.php?topic=710766.0).

Other general [help and troubleshooting advice can be found here.](https://support.arduino.cc/hc/en-us)  
It will help you get the best out of the forum in the future.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [July 15, 2021, 7:40am UTC](https://forum.arduino.cc/t/help-me-code-this-funtion/886280/20 "2021-07-15T07:40:14Z")

</div>

Stop creating duplicate posts or you will be banned for a period

Your THIRD post on this subject has been deleted

Post your full code here using code tags when you do

See [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966#posting-code)

[Next page](https://forum.arduino.cc/t/help-me-code-this-funtion/886280.md?page=2)
