Hold button for call

Hello.
I first time use arduino and need small help.
I find online code for voice call with uno and sim900 and everything work fine but i want to start calling after hold 10sec button not just press. Can someone edit code for me. thanks

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "call.h"

#define ACTIVE LOW

const int ledPin =  13;      // the number of the LED pin

CallGSM call;
boolean started = false;
int buttonState = 1;
const int buttonPin = 7;     // the number of the pushbutton pin
boolean calling = false;

void setup()
{

 Serial.begin(9600);
 pinMode(ledPin, OUTPUT);
 pinMode(buttonPin, INPUT);
 digitalWrite(buttonPin, HIGH);
 if (gsm.begin(9600))
 {
   Serial.println("\nstatus=READY");
   started = true;
 }
 else
   Serial.println("\nstatus=IDLE");
}

void loop()
{
 buttonState = digitalRead(buttonPin);
 if (buttonState == ACTIVE) {
   if (calling)
   {
     digitalWrite(ledPin, LOW);
     calling = false;
     call.HangUp();
     delay(1000);
   } else
   {
     calling = true;
     digitalWrite(ledPin, HIGH);
     delay(1000);
     call.Call("number"); "number"
     ;
   }
 }
}

Why don’t you give it a try and we help out. Start by reading the post about millis() pinned at the top of the forum (and the others too)

If you need to test whether a button is held down for a certain length of time try this

buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {          // assumes LOW when pressed
   lastTimeButtonWasNotPressed = millis();
}

if (millis() - lastTimeButtonWasNotPressed >= interval) {
   // do stuff
}

...R

J-M-L:
Why don’t you give it a try and we help out. Start by reading the post about millis() pinned at the top of the forum (and the others too)

I saw that post but i don’t know where to add code and what delete. I first time use arduino. :frowning:

OK... if you are interested in learning, may be put your "complex" projet aside for a couple days and play with tutos and the simple examples and the language; Once this is mastered you'll see it's not too difficult to achieve what you want to do - but there is a bit of a learning curve

Hi

you PM-ed me which is unwanted as stated in my signature when I say "Please do not PM me for help".

Robin in #2 gave you some code to trigger an action if the button has been down for long enough

if you are interested in paying someone you should post your ask with all the details and specs in Gigs and Collaborations

J-M-L:
Hi

you PM-ed me which is unwanted as stated in my signature when I say "Please do not PM me for help".

Robin in #2 gave you some code to trigger an action if the button has been down for long enough

if you are interested in paying someone you should post your ask with all the details and specs in Gigs and Collaborations

Sorry, i saw you signature after PM.
thanks for help
have a nice day

streeel has now created a thread in Gigs and Collaborations for this project: