当前位置:网站首页>Arduino get random number
Arduino get random number
2022-07-06 12:04:00 【A geek is as deep as the sea】
Use randomSeed() Function to read an unused pin ,
randomSeed(analogRead(A0)); // Use an unused pin
Use random() Function to generate a random number , return long type
random() Functions can be used in two ways
random(max); // Return number type will not Exceed the filled data
random(min,max); // Generate a range of random numbers
Examples of use
void setup() {
Serial.begin(9600);
randomSeed(analogRead(A0)); // Use an unused pin
Serial.println(random(100));
Serial.println(random(100,300));
}
void loop(){
}
边栏推荐
猜你喜欢
随机推荐
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries(XGBoost)
arduino获取随机数
互联网协议详解
高通&MTK&麒麟 手机平台USB3.0方案对比
Redis面试题
Hutool中那些常用的工具类和方法
ToggleButton实现一个开关灯的效果
使用LinkedHashMap实现一个LRU算法的缓存
AMBA、AHB、APB、AXI的理解
mysql实现读写分离
List and set
Variable star user module
Understanding of AMBA, AHB, APB and Axi
Bubble sort [C language]
分布式事务的实现方案
gcc 编译选项
ES6语法总结--下篇(进阶篇 ES6~ES11)
TypeScript
Word排版(小計)
ESP8266通过arduino IED连接巴法云(TCP创客云)