Problem executing a single interrupt on digital output while executing void loop

New here, Hi folks. I am trying to muddle my way through the above. I am new to programming, but slowly learning.

I am trying to generate a reset on the Arduino after a coupled Wemos D1 has connected to the internet. I don't want to have to generate a delay in the Arduino boot, that may be short or long, due to possible changes in the time that it takes to connect. I would like to have the Arduino boot as soon as is practicable. I have tried
while(1) {}
while(true) {}
boolean = true/false.
These either send the Arduino cyclic reset or do nothing. I have even tried connecting a FET to the Arduino reset, but whatever I did, the reset stayed low.

My question is, is there a way that a "one-shot" reset can be generated by the Wemos from the loop, that will not wreck the running of the other processes of the loop? I am currently using (attempting to use) the Wemos D1, as I don't have an Arduino WiFi shield, but I guess that the code would be the same anyway. Thanks in eager anticipation......

CGMarsh:
is there a way that a "one-shot" reset can be generated by the Wemos from the loop, that will not wreck the running of the other processes of the loop?

An Arduino has only one process - if you cause a reset then everything is reset.

There should be no need for any reset if a program is written correctly.

Post your program so we can see what you are talking about.

...R

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth = “My authentication token in here”;

// Your WiFi credentials.
// Set password to “” for open networks.
char ssid = “my ssid”;
char pass = “my password”;
int reset = D4; // Pin is active high and connected to Arduino reset pin through 10k resistor
// switched by FET

void setup(){
Serial.begin(9600); // Start serial monitor

pinMode(reset, OUTPUT); //Set up D4 pin on Wemos D1 to output
pinMode(0&&2, OUTPUT); // sets the digital pins 0, 1, 2 as outputs
pinMode(5&&7, OUTPUT); // sets the digital pin3 5, 6, 7 as output3

Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, “blynk-cloud.com”, 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
void pinout(){
digitalWrite(0&&2, LOW); // Reset pins 0, 1, 2
digitalWrite(5&&7, LOW); // Reset pins 5, 6, 7
delay(200);
digitalWrite(0&&2, HIGH); // Normalise pins 0, 1, 2
digitalWrite(5&&7, HIGH); // Normalise pins 5, 6, 7

digitalWrite(reset, LOW); // Hold reset on Arduino low while D1 boots to server
delay (20); // Hopefully not long enough to affect web connection
digitalWrite(reset, HIGH); // Release Arduino from reset
}

void loop(){

Blynk.run();

}

//This sketch causes the reset pin on the Arduino to stay low, although the output of D4 on the Wemos D1 returns high. Remove link and Arduino boots

I don’t think so, but a question is “Is there something different about the Arduino reset pin”?

I thought that global characters worked. They appear to not work with this stuff. I was trying to save script, but entering individual pinMode and digitalWrite statements fixes the latching of Arduino reset line. Curious though, D4 reset was not included in any global string...Still looking to develop code within the loop as arduino boots before Wemos establishes web connection. Unfortunately I don't have access to the programme in the Arduino.

I know nothing about Blynk and I don't recognize this style digitalWrite(5&&7, HIGH); maybe it is something specific to the Blynk library.

Are you trying to cause the Arduino to reset itself? OR, are you trying to cause the Arduino to make something else reset?

...R

Robin2:
I know nothing about Blynk and I don't recognize this style digitalWrite(5&&7, HIGH); maybe it is something specific to the Blynk library.

It is just wishful thinking syntax.

  pinMode(0&&2, OUTPUT);    // sets the digital pin 0 output
  pinMode(5&&7, OUTPUT);    // sets the digital pin 1 as output
 digitalWrite(0&&2, LOW);     // Reset pin 0
 digitalWrite(5&&7, LOW);     // Reset pin 1
 delay(200);
 digitalWrite(0&&2, HIGH);     // Normalise pin 0
 digitalWrite(5&&7, HIGH);     // Normalise pin 1
 
 digitalWrite(reset, LOW);     // set reset on Arduino low (restarting the Arduino)
 delay (20);                   // will never be reached
 digitalWrite(reset, HIGH);    // like above

As I said earlier, I am very new to this and learning, WRT the &&, I saw it somewhere on the net, tried it and it seemed to work. I know from experience that the Ericsson AXE10 exchange software allows for global characters, ie 1&&8 which equates to 1 to 8 inclusive. It now appears that what I saw was incorrect.

I am trying to externally reset an Arduino, from a Wemos D1 R2. I do not have access to the source in the Arduino, so I have to generate an interrupt AFTER the D1 has connected to the net, so that I would then have time to break into the Arduino boot-up and activate setup menu's. I have about 2 seconds after the Arduino boots to do this. My understanding is that this would need to be triggered from void loop().

I have been working on this for quite a while. I believe that I am nearly there, but I still have issues with the void loop() interrupt. I tried a timer generated interrupt, but that caused D1 connection errors. Do you think that I am on the right track? Thanks, Colin.

Ok, I did not realize that the code is to run on the wemos, so the delay etc will be executed.

I would send the Arduino into reset in begin and release the reset when the connection is ready to be used in loop.

Hi Whandall. I tried that. I set the Arduino reset pin low in void setup() and was trying to send it back high from within the void loop() after Blynk web server connection, using Timer. I reckon that I am close, but at the moment I am getting "wdt reset, load 0x4010f000, len 1384, room 16 errors". It would appear that the error is associated with the timer function. I am now seeing stuff on the net about a watchdog timer maybe causing this sort of issue. I know that the basics/theory is sound, all I have to do is figure out the syntax. My head hurts, this has/is being a steep learning curve. I guess that I should have taken the opportunity when it was presented at RMIT to learn a language other than English -:frowning: ..

CGMarsh:
I set the Arduino reset pin low in void setup() and was trying to send it back high from within the void loop() after Blynk web server connection, using Timer

Why use a timer at all?

if (releaseArduino) {
  digitalWrite(...);
  releaseArduino = false;
}

My understanding was that delays would cause other issues. Oh, I see the code. Would that work a hard wired connection?

You don't need any delays or timing.

It does not hurt to hold the Arduino in reset as long as you like.

So I would 'assert Arduinos reset' in setup and 'release Arduino reset' in loop when the time has come.

Hi Whandal. I understand what you are saying and that is basically what I have done, but for one thing. Because the Wemos takes about 5-8 seconds to boot and connect to server (and the Arduino takes about 4), I need to extend the release for that time difference, hence the timing delay. Any delay breaks into the Blynk programme and I am back at square 1. It looks like I need to fix the loop because I need about 4-6000 millis. Appreciate the help.