Arduino Nano Blink continuosly after Reset Function implemented into Sketch

Hello to every body and happy new year!

I am developing a program in Python which send by its GUI some commands to arduino nano by COM 7 USB Port.
ON/OFF Leds, Stepper, ect are OK, but I need to reset the micro via software command/script (without forcing the HW reset sending ZERO Voltage to ground signal pin.

I tried to load several sw segment found into the web, it reset the micro but then is impossible to run the other commands into the GUI to activate or de-activate the Arduino function.

During the last testing to load the new modified sketch, the "L" LED blinks very fast and seems that is not possible to load the sketch even if it seems to be uploaded correctly (NO ERROR highlighet) but NO FUNCTION enabled on the GUI (previously everything were fine) and repeat no possibility to block the blinking (even if I push the reset button).

Thanking you in advance for your help I send you my best regards

Fabio

Can you upload e.g. blink to see if that works. It's just for testing if your upload is successful.

without forcing the HW reset sending ZERO Voltage to ground signal pin.

What does that mean?

I think that it will also be useful if we can have a look at your code; don't forget to post it between
** **[code]** **
and
** **[/code]** **

Surfing in deep into the web I found this solution that works fine for my issue:

I successfully restored both boards using the reset button:
1.
Power off the board (I disconnected the USB cable from computer)
2.
Press and hold the reset button
3.
Connect USB cable (keep holding the reset button)
4.
Click "Upload Sketch"
5.
Wait a second or two until Arduino software says "Uploading..." in the status bar
6.
Release the reset button
Use these steps to upload any small sketch, Blink example is a good choice :slight_smile:

Thank you

[tt][tt][color=#454545]I re-open this topic since even if I fixed the issue (now the sketch is uploaded correctly), [/color][/tt][/tt][tt][tt][color=#454545]I[/color][/tt][/tt] can't reset the micro via software, so I connected an output pin programmed at level the other to the reset pin of the arduino born with atmega 328 and when on the GUI in python I press the virtual reset button, it sends me to level logic ZERO the output of pin 8 of the arduino nano which is connected to the RESET pin of the microcontroller which resets with low active ... but after the reset the LED "L" starts flashing again as written in the first post but more slowly and since then I can't do anything in the GUI until I physically unplug the cable from the RESET pin.

Thanks again for your help/sugestions
Fabio

Time to show a schematic (photo of hand drawn one is fine) as well as time to show your code (please post your code between
** **[code]** **
and
** **[/code]** **
).

Why do you need a reset functionality?

First of all thank you for your support ...

I am moving a stepper motor in CW and CCW direction and switch ON/OFF a led using Aruino Nano simply sending these commands by a PC Windows GUI made by Phyton, which send on its serial output the commands to arduino nano connected to USB (com7 port);

LED ON/OFF and stepper rotation works fine, but when the rotation of stepper is finished the 4 leds monted on stepper driver board remain ON and reset the micro using its push button they become OFF.
Now I create on the GUI a simple PUSH buttoms where I switch ON/FF the LED and Stepper ritation but when I want to reset the micro (it is just a RESET function for testing/trouble shooting purpose) it seems do not work and the stepper or LED ON/OFF (no relevant to the stepper control, but connected to ARDUINO) are not comandable..

This is the code


  • Wiring List: *
  • #4 Blue Wire on White Connector *
  • #5 Pink Wire on White Connector *
  • #6 Yellow Wire on White Connector *
  • #7 Orange Wire on White Connector *
  • White Wire from D8(PIN12) to PIN RESET - ACTIVE LOW (PIN29) by resistor of 100 ohm *

***************************************************************************************************************/

#include <Stepper.h> // Stepper Library
#define STEPS 2038 // Number of Steps in one motor revolution (2048 TBV)

Stepper stepper(STEPS, 7, 5, 6, 4); //(D4 ORANGE), (D5-YELLOW), (D6-GREEN), (D7-BLUE) ARDUINO PINS/WIRE COLOR)
// Exchanging 7 with 4 order the stepper move only in one direction

//
int STEP_MOTOR_D7 = 7;
int STEP_MOTOR_D4 = 4;
int STEP_MOTOR_D5 = 5;
int STEP_MOTOR_D6 = 6;
int Backlight_D12 = 12; // Test light (Amber LED)*/
int Reset_D8 = 8;
/
/
void setup() {
pinMode(STEP_MOTOR_D7, OUTPUT);
pinMode(STEP_MOTOR_D4, OUTPUT);
pinMode(STEP_MOTOR_D7, OUTPUT); //CHANGE in D5
pinMode(STEP_MOTOR_D4, OUTPUT); //CHANGE in D6
pinMode(Backlight_D12, OUTPUT);
pinMode(Reset_D8, OUTPUT);
digitalWrite(Reset_D8, HIGH); // Reset inhibited
Serial.begin(9600);
}
/**************************************************************************************************************/
void loop() {

if (Serial.available()) {
unsigned char c = Serial.read(); /CHAR (from -128 to +127), UNSIGNED CHAR (from 0 to 255)/
if (c == '1') {
digitalWrite(Backlight_D12, HIGH);
delay(1);
}
else if (c == '2') {
digitalWrite(Backlight_D12, LOW);
delay(1);
}
else if (c == '3') {
stepper.setSpeed(1);
stepper.step(-2038); // This command permit a CCW rotaion (in my stepper being the mptor case mounted in reverse mode I put -2038 for CW)
stepper.setSpeed(0);
delay(500);
}
else if (c == '4') {
stepper.setSpeed(1);
stepper.step(2038); // This command permit a CW rotaion (in my stepper being the mptor case mounted in reverse mode I put 2038 for CW)
stepper.setSpeed(0);
delay(500);
}
else if (c == '5') {

digitalWrite(Reset_D8, LOW);
delay(2000); // 8000?
digitalWrite(Reset_D8, HIGH);
}
}
}

yesterday putting a 100ohm resistor between the RESET PIN and D8 the circuit worked. Today NO :frowning:

Issue fixed !!!
Bad contact between pin D8 and resistor which is necessary for RESET Function otherwise it doesn't work

Thanks for your cooperation

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