How can I “reset” an Arduino board?

前端 未结 21 1789
不思量自难忘°
不思量自难忘° 2020-12-13 01:07

I\'ve uploaded a sketch to an Arduino Uno whose loop is something like this:

void loop(){
    Serial.println(\"Hello, World!\");
}

So, now,

相关标签:
21条回答
  • 2020-12-13 01:20

    If the port says Already used, then you are probably using the wrong port.

    Switch it to the port where you connected your Arduino and then try to re-upload, you will definitely see it work.

    0 讨论(0)
  • 2020-12-13 01:24

    Try the following:

    1. Prepare the basic empty program (empty setup, loop, etc.)
    2. Compile it.
    3. Reset the Arduino using the hardware button on the chip
    4. Press Ctrl + U to upload your code.
    5. If unsuccessful - got to 3.

    There is a delay before the boot loader starts the programs, just work on your timing. It worked for me when a bug in my Arduino's code was executing a soft reset every 500 ms.

    0 讨论(0)
  • 2020-12-13 01:24

    I got a similar problem.

    If I power on my Arduino, there is a delay before the uploaded program execute.

    So I use that delay for uploading new program, or empty program:

    void setup(){}
    
    void loop(){}
    

    So my problem was solved.

    Unplug any connection to Arduino pins before upload.

    0 讨论(0)
  • 2020-12-13 01:25

    Arduino Leonardo board:

    1. Unplug the USB cable
    2. Connect the RX Pin to ground
    3. Plug in the USB cable
    4. Upload a new program
    5. Remove the USB cable
    6. Remove the RX grounding
    0 讨论(0)
  • 2020-12-13 01:25

    I had the very same problem today. Here is a simple solution we found to solve this issue (thanks to Anghiara):

    Instead of loading your new code to the Arduino using the "upload button" (the circle with the green arrow) in your screen, use your mouse to click "Sketch" and then "Upload".

    Please remember to add a delay() line to your code when working with Serial.println() and loops. I learned my lesson the hard way.

    0 讨论(0)
  • 2020-12-13 01:28

    Here's what I did in Linux to be able to program my Arduino Micro which was stuck in a loop sending the 0 key when connected by USB;

    # while true; do xinput float $(xinput --list | grep -i Arduino | awk '{print $7}' | cut -d'=' -f 2); done
    

    Your output might be slightly different so just try running;

    # watch xinput --list
    

    then plug in the Arduino and see how the output is formatted.

    This stopped X from accepting the keypresses and allowed the Arduino IDE to program finally!

    0 讨论(0)
提交回复
热议问题