物联网实验Arduino(1)
回顾
我们使用的平台:
Arduino
入门实验1
眨眼睛
- /*
- Blink
- Turns an LED on for one second, then off for one second, repeatedly.
- Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
- it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
- the correct LED pin independent of which board is used.
- If you want to know what pin the on-board LED is connected to on your Arduino
- model, check the Technical Specs of your board at:
- https://www.arduino.cc/en/Main/Products
- modified 8 May 2014
- by Scott Fitzgerald
- modified 2 Sep 2016
- by Arturo Guadalupi
- modified 8 Sep 2016
- by Colby Newman
- This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/Blink
- */
- // the setup function runs once when you press reset or power the board
- void setup() {
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(LED_BUILTIN, OUTPUT);
- }
- // the loop function runs over and over again forever
- void loop() {
- digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(); // wait for a second
- digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
- delay(); // wait for a second
- }
编译上传之后,可以见到开发板自带的LED交替闪亮
跑马灯
- int led1=;
- int led2=;
- int led3=;
- int n;
- void setup() {
- // put your setup code here, to run once:
- //设置各个引脚的初始状态
- for(n=;n<=;n++)
- {
- pinMode(n, OUTPUT);
- }
- }
- void loop() {
- // put your main code here, to run repeatedly:
- turn1();//顺序点亮,顺序熄灭
- clean(); //灭掉所有灯
- turn2();//3灯齐闪
- clean();//灭掉所有灯
- }
- void turn1() //顺序点亮,顺序熄灭
- {
- for(n=;n<=;n++)
- {
- digitalWrite(n,HIGH);
- delay();
- }
- for(n=;n<=;n++)
- {
- digitalWrite(n,LOW);
- delay();
- }
- }
- void turn2()//3灯齐闪3次
- {
- for(int x=;x<=;x++)
- {
- for( n=;n<=;n++)
- {
- digitalWrite(n,HIGH);
- }
- delay();
- for(n=;n<=;n++)
- {
- digitalWrite(n,LOW);
- }
- delay();
- }
- }
- void clean()
- {
- for(n=;n<=;n++)
- {
- digitalWrite(n,LOW);
- }
- delay();
- }
接线如下图
接5-7引脚
物联网实验Arduino(1)的更多相关文章
- 物联网实验4 alljoyn物联网实验之手机局域网控制设备
AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...
- (原创) alljoyn物联网实验之手机局域网控制设备
AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...
- 初探物联网 - 基于Arduino的气象站和View and Data API的结合实例
如果你参加了上个月在北京的Autodesk 开发者日,你应该看到了我做的关于Arduino的物联网实例演示,如果你没看到,欢迎参加14号在上海的开发者日,到时候我会再演(xian)示(bai)一下. ...
- 【物联网】arduino wifi
https://www.arduino.cn/forum.php?mod=viewthread&tid=49561 http://dy.163.com/v2/article/detail/DC ...
- Arduino教程资料汇总(8月22日悄悄跟新了一下)
http://www.geek-workshop.com/thread-985-1-1.html 本帖最后由 迷你强 于 2013-8-31 12:36 编辑 =====F-101 arduino基础 ...
- 可能是Mac环境变量恢复的参考
因为要做物联网实验的缘故,于是在Mac上用Android Studio想导入SensorSimulator的demo项目. 根据SensorSimulator的相关说明,需要先将Sensor Simu ...
- 迈出物联网的第一步,玩儿一下Arduino
大家知道,现在物联网Internet of Things(IoT) 方兴未艾,各种智能设备层出不穷,手表.手环.甚至运动鞋等可穿戴设备,还有智能家居产品,无时无刻不冲击着我们的思想和眼球.Autode ...
- 基于 Arduino 的 RFID 识别实验
http://www.it165.net/embed/html/201512/3287.html 2015年12月04日(周五) 上午 博士的智能卡实验--RFID识别实验,基于51单片机: 我们的 ...
- Arduino示例教程超声波测距实验
超声波传感器 超声波是一种超出人类听觉极限的声波即其振动频率高于20 kHz的机械波.超声波传感器在工作的时候就是将电压和超声波之间的互相转换,当超声波传感器发射超声波时,发射超声波的探头将电压转化的 ...
随机推荐
- 【Linux】Linux常用命令及操作 (一)
一.Linux简介 二.Linux基础命令 三.工作常用命令 --------------------------------------------------------------------- ...
- 用nodejs实现向文件的固定位置插入内容
往文件的固定的行写入数据: 需要用到时nodejs的fs模块和path模块 用到fs模块的方法 readFileSync & writeFileSync : readFileSync 是读取文 ...
- selenium:selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
可用链接: 1.http://blog.csdn.net/heatdeath/article/details/71136174 2.https://www.cnblogs.com/yousuosiys ...
- Python之爬虫(十五) Scrapy框架的命令行详解
这篇文章主要是对的scrapy命令行使用的一个介绍 创建爬虫项目 scrapy startproject 项目名例子如下: localhost:spider zhaofan$ scrapy start ...
- day4 python 运算符
python运算符 1.算数运算符( + - * / // % ** ) # + - * / // % ** # 加 减 乘 除 整除 余数 幂 #注意 #1. / 得到浮点型, // 得看被除数 ...
- bilibili自定义调整视频播放速度
自定义调整视频播放速度 在b站的播放页面,按下f12,打开控制台 在控制台中复制下面代码,想几倍速就把2.5改成你想要的播放速度 document.querySelector('video').pla ...
- Ethical Hacking - Web Penetration Testing(12)
XSS VULNS XSS - CROSS SITE SCRIPTING VULNS Allow an attacker to inject javascript code into the page ...
- Vue脚手架的搭建和路由配置
- CUDA C++ Extensions
敲代码的时候总是会去CUDA官方文档中找找思路,感觉每次看英文文档都要耗费一点时间来翻译,干脆自己翻译一下便于以后查阅.官方文档:cuda-c-language-extensions 目录 函数修饰符 ...
- vuex : 用vuex控制侧栏点亮状态
上代码. xxx.vue <template> <div id="xxx"> <div class="layout"> &l ...