Arduino重置-复位问题

转自: https://blog.csdn.net/y511374875/article/details/77845240html

三种方式手动重启Arduinogit

1.Arduino板上从新编写代码时,Arduino将从新设置 2.Arduino软件中打开串行终端,同时将Arduino板链接到计算机。打开串行终端时,Arduino会自动重置 3.按下复位按钮编程

 

两种方式自动重启Arduino函数

详情见: https://www.theengineeringprojects.com/2015/10/upload-bootloader-atmega328.htmloop

1.使用Arduino板上的RESET引脚以编程方式从新设置Arduino,就是利用一个数字口,代码运行到那的时候就将REST置低 这里利用数字口D2ui

int Reset = 2;this

void setup() {    digitalWrite(Reset, HIGH);   delay(200);   pinMode(Reset, OUTPUT);       Serial.begin(9600);   Serial.println("How to Reset Arduino Programmatically");   delay(200); }.net

void loop() {   Serial.println("A");   delay(1000);                 Serial.println("B");   delay(1000);                 Serial.println("Now we are Resetting Arduino Programmatically");   Serial.println();   delay(1000);   digitalWrite(Reset, LOW);   Serial.println("Arduino will never reach there.");code

}1234567891011121314151617181920212223htm

2.不使用任何硬件引脚,Arduino有一个名为resetFunc()的内置函数,咱们声明函数地址为0,当咱们执行此功能时,Arduino将自动重置。

说明: –In this method, we are not gonna use any hardware pin, instead we will do everything in programming. –Arduino has a builtin function named as resetFunc() which we need to declare at address 0 and when we execute this function Arduino gets reset automatically. –So, no need of doing anything in hardware and simply upload the below code in your Arduino board.

 

void(* resetFunc) (void) = 0;

void setup() {       Serial.begin(9600);   Serial.println("How to Reset Arduino Programmatically");   delay(200); }

void loop() {   Serial.println("A");   delay(1000);                 Serial.println("B");   delay(1000);                 Serial.println("Now we are Resetting Arduino Programmatically");   Serial.println();   delay(1000);   resetFunc();   Serial.println("Arrduino will never reach there.");

相关文章
相关标签/搜索