博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Arduino重置-复位问题
阅读量:4313 次
发布时间:2019-06-06

本文共 1833 字,大约阅读时间需要 6 分钟。

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

三种方式手动重启Arduino

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

 

两种方式自动重启Arduino

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

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

int Reset = 2;

void setup() {    digitalWrite(Reset, HIGH);   delay(200);   pinMode(Reset, OUTPUT);       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);   digitalWrite(Reset, LOW);   Serial.println("Arduino will never reach there.");

}1234567891011121314151617181920212223

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.");

} --------------------- 作者:y511374875 来源:CSDN 原文:https://blog.csdn.net/y511374875/article/details/77845240 版权声明:本文为博主原创文章,转载请附上博文链接!

 

转载于:https://www.cnblogs.com/MCSFX/p/10495973.html

你可能感兴趣的文章
YII2 电话号码的验证规则
查看>>
SPFA模板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板板...
查看>>
java注解
查看>>
[翻译] Fast Image Cache
查看>>
iOS文件处理类
查看>>
Hadoop集群datanode磁盘不均衡的解决方案
查看>>
Vue 开源项目库汇总(转)
查看>>
403 ,502 到正确的nginx 配置
查看>>
[Nescafé41]异化多肽(多项式求逆元)
查看>>
网络中常见的ping命令协议
查看>>
不用position,让div垂直居中
查看>>
sql 语句 查找
查看>>
谓词和运算符
查看>>
WIN10打开资源管理器显示该文件没有与之关联的程序来执行该操作.请安装应用,请在“默认应用设置”..关联 —— 解决方案...
查看>>
HttpWebRequest中的SendChunked
查看>>
linux文件存储方式
查看>>
闭包函数与装饰器
查看>>
android中bitmap图片与二进制,String间的转化
查看>>
数据库的优化有哪些?
查看>>
PyCharm导入包的问题
查看>>