回顾

我们使用的平台:

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. 爬虫页面解析 lxml 简单教程

    一.与字符串的相互转换 1.字符串转变为etree 对象 import lxml.html tree = lxml.html.fromstring(content) # content 字符串对象 2 ...

  2. 01 drf源码剖析之restful规范

    01 restful规范 目录 01 restful规范 1. 什么是restful规范 2.restful规范详细 1. 什么是restful规范 restful是一套规则,是程序间进行数据传输的一 ...

  3. How to use the functions of apply and call

    Although  apply and  call  can implement same function. However, there is a litter different between ...

  4. 手把手整合SSM框架

    前言 如果看过前几篇文章,对 Spring 和 MyBatis 有了一定了解,一定想上手试试.这篇文章从 0 到 1,手把手整合 SSM (Spring.Spring MVC.MyBatis). 本篇 ...

  5. LeetCode 84 | 单调栈解决最大矩形问题

    本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是LeetCode专题第52篇文章,我们一起来看LeetCode第84题,Largest Rectangle in Histogram( ...

  6. CSS上划线、下划线、删除线等方法

    text-decoration:underline;     下划线 text-decoration:overline;    顶划线 text-decoration:line-through;  删 ...

  7. 题解 洛谷 P2046 【[NOI2010]海拔】

    首先进行贪心,发现海拔有梯度时一定是不优的,最优的情况是海拔像断崖一样上升,也就是左上角有一片海拔高度为\(0\),右下角有一片海拔高度为\(1\). 发现这样的性质后,不难想到用最小割来解决问题,但 ...

  8. Linux字符集的查看及修改[转]

    一·查看字符集字符集在系统中体现形式是一个环境变量,以CentOS6.5为例,其查看当前终端使用字符集的方式可以有以下几种方式: 1.[root@david ~]# echo $LANGzh_CN.G ...

  9. DJANGO-天天生鲜项目从0到1-008-列表页

    本项目基于B站UP主‘神奇的老黄’的教学视频‘天天生鲜Django项目’,视频讲的非常好,推荐新手观看学习 https://www.bilibili.com/video/BV1vt41147K8?p= ...

  10. springboot(二)配置SpringBoot支持自动装载Servlet

    Servlet详解:https://blog.csdn.net/yanmiao0715/article/details/79949911 Web 技术成为当今主流的互联网 Web 应用技术之一,而 S ...