/*
Simple example for receiving https://github.com/sui77/rc-switch/
*/ #include <RCSwitch.h>
#define led1 10
#define led2 11
RCSwitch mySwitch = RCSwitch(); void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
} void loop() {
if (mySwitch.available()) { int value = mySwitch.getReceivedValue(); if (value == 0) {
Serial.print("Unknown encoding");
} else {
if (value ==17) {
if( digitalRead(led1)==0){
digitalWrite(led1, HIGH);
}
else{
digitalWrite(led1, LOW);
}
}
if (value ==18) { if( digitalRead(led2)==0){
digitalWrite(led2, HIGH);
}
else{
digitalWrite(led2, LOW);
} }
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
} mySwitch.resetAvailable();
}
}

  

Arduino 433 自定义接受的更多相关文章

  1. Arduino 433 自定义发射

    /* This is a minimal sketch without using the library at all but only works for the 10 pole dip swit ...

  2. Arduino 433 + 串口

    http://www.freebuf.com/articles/wireless/105398.html /*本作品使用的例程中包含RCSwitch库文件用于信号的解码和编码发送*/ #include ...

  3. 433 模块 ARDUINO测试

    实验硬件 发射端 Arduino + 433超外差发射机     高,低电平和悬空三种模式切换  由简单的官方库修改 /* This is a minimal sketch without using ...

  4. Arduino语法-变量和常量

    变量的声明: int led=11 一般变量的声明方法为类型名+变量名+变量初始化值.变量名的写法约定为首字母小写 变量的作用范围又称为作用域,变量的作用范围与该变量在哪儿声明有关,大致分为如下两种: ...

  5. @RequestBody 注意的问题

    contentType : "application/json", //只能是这个 RequestBody 不能和form/data共存: @RequestMapping(valu ...

  6. springboot+springsecurity+thymeleaf

    来源:听秦疆老师的课笔记 springsecurity是一个权限管理框架,用来授权,认证,加密等等......类似的工具还有shiro 1.整合 我用的是springboot2.2.0版本,导入以下依 ...

  7. jackson处理日期异常

    原 jackson处理日期异常 2018年01月09日 10:50:19 阅读数:70 1.异常信息 2.原因 默认情况下,fasterxml json只支持几种format,但是肯定不支持" ...

  8. 《流畅的Python》第三部分 把函数视作对象 【一等函数】【使用一等函数实现设计模式】【函数装饰器和闭包】

    第三部分 第5章 一等函数 一等对象 在运行时创建 能赋值给变量或数据结构中的元素 能作为参数传递给函数 能作为函数的返回结果 在Python中,所有函数都是一等对象 函数是对象 函数本身是 func ...

  9. (二)React Ant Design Pro + .Net5 WebApi:前端环境搭建

    首先,你需要先装一个Nodejs,这是基础哦.如果没有这方面知识的小伙伴可以在园子里搜索cnpm yarn等关键字,内容繁多,此不赘述,参考链接 一. 简介 1. Ant Design Pro v5 ...

随机推荐

  1. SQLServer 2008R2 清理日志文件

    设置数据库为简单模式 2.收缩日志文件 3.恢复数据库为完整模式

  2. EXISTS 执行顺序

    select * from a where a.s_status=1 and exists (select orderid from b where a.orderid=b.orderid) exis ...

  3. 【RabbitMQ】6、rabbitmq生产者的消息确认

    通过Publisher Confirms and Returns机制,生产者可以判断消息是否发送到了exchange及queue,而通过消费者确认机制,Rabbitmq可以决定是否重发消息给消费者,以 ...

  4. canvas-star0.html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. c语言学习笔记-switch

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一.switch函数意义 选择性执行 二.switch函数结构 switch(表达式) { case: 常量表达式; 语句1; ...

  6. tfs 禁止多人签出

    好久没用tfs了,忘了怎么设置了,记录下 编辑----->高级

  7. 安卓开发_浅谈DatePicker(日期选择器)

    DatePicker继承自FrameLayout类,日期选择控件的主要功能是向用户提供包含年.月.日的日期数据并允许用户对其修改.如果要捕获用户修改日期选择控件中的数据事件,需要为DatePicker ...

  8. Angular基础(八) Observable & RxJS

    对于一个应用来说,获取数据的方法可以有很多,比如:Ajax, Websockets, LocalStorage, Indexdb, Service Workers,但是如何整合多种数据源.如何避免BU ...

  9. Units in Android

    一般使用dp,不使用px.sp啥时候用呢?给TextView设置文字大小的时候用.

  10. 【JS单元测试】Qunit 和 jsCoverage使用方法

          近日在网上浏览过很多有关js单元测试相关的文档,工具,但是,针对Qunit 和 jsCoverage使用方法,缺少详细说明,对于初入前端的人来说,很难明白其中的意思,特此整理这篇文章,希望 ...