Running one program inside of another

Hello. I currently have two different sketches. The first one: uploads to my arduino uno, involves a servo moving "x" amount of times as displayed by a 7 segment display after a button is pressed The second one: uploads to ESP8266, uses pushbullet and pushingbox to send a notification to my phone

Is there anyway I can integrate these two codes together so that the notification is sent to my phone after the servo movement is complete? Right now I have the ESP8266 chip connected to a separate arduino uno. I cannot just "throw the code together" because the 2 codes have to be uploaded to different places; the first to the arduino uno and the second to the ESP8266.

Have you connected the arduino and the ESP so they can communicate with each other?

zoomkat: Have you connected the arduino and the ESP so they can communicate with each other?

The ESP I have is the ESP8266-01. I have it connected to one arduino uno, which communicates well with it. It is not connected to the other arduino uno that runs the servo code.

How far apart are the two Unos?

cattledog: How far apart are the two Unos?

They are right next to each other

I think that instead of trying to integrate the codes, I can connect the push button to both codes. Currently it is connected to the code that triggers the servo movement. Can i connect it to the ESP8266?

can connect the push button to both codes. Currently it is connected to the code that triggers the servo movement. Can i connect it to the ESP8266?

It’s not clear to me how you can have one button with the two different voltage levels between the uno and the esp8266. I’m not a hardware guy, but I think it could be done with external pulldowns on both inputs and a 3.3v supply to the button which connects the voltage to the inputs when pressed. The 5v Arduino should treat anything above 3v as HIGH.

Is there anyway I can integrate these two codes together so that the notification is sent to my phone after the servo movement is complete?

If you have the button trigger the movement and the notification, you get the notification that the servo has started not completed. You have not said how long the servo movement takes, if there is a need for positive confirmation that it has actually moved and completed the movement.

cattledog:
It’s not clear to me how you can have one button with the two different voltage levels between the uno and the esp8266. I’m not a hardware guy, but I think it could be done with external pulldowns on both inputs and a 3.3v supply to the button which connects the voltage to the inputs when pressed. The 5v Arduino should treat anything above 3v as HIGH.

If you have the button trigger the movement and the notification, you get the notification that the servo has started not completed. You have not said how long the servo movement takes, if there is a need for positive confirmation that it has actually moved and completed the movement.

I have the pushbutton correctly installed to trigger the servo movement, I just do not know the correct way to install it on the ESP8266. The servo movement only takes a couple of seconds, so I think it would be okay if the push button also triggered the ESP due to delay, the notification would arrive on my phone after the servo movement was complete

How is the button currently wired to the Uno? What is the pinMode setting of the input pin?

I think that for a common button to work, it will need to supply 3.3v when pressed to both a uno and esp i/o pin with INPUT pin mode. To keep the input pins from floating when the button is not pressed, they will need external pulldown resistors (10K) to ground.

You have UnoA that controls a servo and UnoB that controls an ESP8266.

Why not produce a single program for UnoB that controls the servos as well as the ESP8266? Then you don't need UnoA and there would be no problem getting the ESP8266 to do things at the appropriate time.

If you think there is some obstacle to doing that then please post the programs from the two Unos

...R

How many servos? The ESP8266 I know has 8 I/O pins and loads more processor than an Uno, you may not need the Unos at all.

Does your code use delays for timing?