回顾

我们使用的平台:

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)的更多相关文章

  1. 物联网实验4 alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  2. (原创) alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  3. 初探物联网 - 基于Arduino的气象站和View and Data API的结合实例

    如果你参加了上个月在北京的Autodesk 开发者日,你应该看到了我做的关于Arduino的物联网实例演示,如果你没看到,欢迎参加14号在上海的开发者日,到时候我会再演(xian)示(bai)一下. ...

  4. 【物联网】arduino wifi

    https://www.arduino.cn/forum.php?mod=viewthread&tid=49561 http://dy.163.com/v2/article/detail/DC ...

  5. Arduino教程资料汇总(8月22日悄悄跟新了一下)

    http://www.geek-workshop.com/thread-985-1-1.html 本帖最后由 迷你强 于 2013-8-31 12:36 编辑 =====F-101 arduino基础 ...

  6. 可能是Mac环境变量恢复的参考

    因为要做物联网实验的缘故,于是在Mac上用Android Studio想导入SensorSimulator的demo项目. 根据SensorSimulator的相关说明,需要先将Sensor Simu ...

  7. 迈出物联网的第一步,玩儿一下Arduino

    大家知道,现在物联网Internet of Things(IoT) 方兴未艾,各种智能设备层出不穷,手表.手环.甚至运动鞋等可穿戴设备,还有智能家居产品,无时无刻不冲击着我们的思想和眼球.Autode ...

  8. 基于 Arduino 的 RFID 识别实验

    http://www.it165.net/embed/html/201512/3287.html 2015年12月04日(周五) 上午  博士的智能卡实验--RFID识别实验,基于51单片机: 我们的 ...

  9. Arduino示例教程超声波测距实验

    超声波传感器 超声波是一种超出人类听觉极限的声波即其振动频率高于20 kHz的机械波.超声波传感器在工作的时候就是将电压和超声波之间的互相转换,当超声波传感器发射超声波时,发射超声波的探头将电压转化的 ...

随机推荐

  1. 2020年Java基础高频面试题汇总(1.4W字详细解析,你能遇到的都在这了)

    1. Java语言有哪些特点 (1)简单易学.有丰富的类库 (2)面向对象(Java最重要的特性,让程序耦合度更低,内聚性更高) (3)与平台无关性(JVM是Java跨平台使用的根本) (4)可靠安全 ...

  2. Django的Cookie Session和自定义分页

    cookie Cookie的由来 大家都知道HTTP协议是无状态的. 无状态的意思是每次请求都是独立的,它的执行情况和结果与前面的请求和之后的请求都无直接关系,它不会受前面的请求响应情况直接影响,也不 ...

  3. Spring Boot 2.3.0正式发布:优雅停机、配置文件位置通配符新特性一览

    当大潮退去,才知道谁在裸泳..关注公众号[BAT的乌托邦]开启专栏式学习,拒绝浅尝辄止.本文 https://www.yourbatman.cn 已收录,里面一并有Spring技术栈.MyBatis. ...

  4. 二、Python系列——time时间格式的转换及计算

    # -*- coding:utf-8 -*- import pandas as pd import time import datetime start_date = '2020-06-08' # 一 ...

  5. 第五章:理解RemoteViews

    RemoteView应该是一种远程View,表示的是一个View结构,他可以在其它进程中显示. 在android中使用场景有两种:通知栏和桌面小部件 5.1 RemoteView的应用 5.1.1 R ...

  6. git push到远程新分支

    获取远程代码并在本地切换到一个新分支修改后,想要 push 到远端与原来不同的新分支,可以使用下面的命令实现: git push origin 本地分支:远端希望创建的分支 上面的本地分支 是基于拉取 ...

  7. 一个有趣的问题, 你知道SqlDataAdapter中的Fill是怎么实现的吗

    一:背景 1. 讲故事 最近因为各方面原因换了一份工作,去了一家主营物联柜的公司,有意思的是物联柜上的终端是用 wpf 写的,代码也算是年久失修,感觉技术债还是蛮重的,前几天在调试一个bug的时候,看 ...

  8. 关于IDEA的一些快捷键操作

    shift+F6修改实体类中的属性会重构代码

  9. F - Maximal Intersection --------暴力求解题

    You are given n segments on a number line; each endpoint of every segment has integer coordinates. S ...

  10. 如何在sed中使用变量,两种方法

    第一 在sed条件中是不认识变量取值的 sed '/$x/d' test 所以要想它能够识别变量 sed "/$x/d/" test 方法简单就是把"单引号"变 ...