资源简介
内包含了前进后退基础功能代码 蓝牙小车代码 红外遥控小车 超声波避障小车 红外避障小车 循迹小车 小车花式动作等多方面的代码,非常适合初学arduino的小白借鉴使用,代码都是经过验证的,没有bug
代码片段和文件信息
/*
* IRremote
* Version 0.11 August 2009
* Copyright 2009 Ken Shirriff
* For details see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
*
* Modified by Paul Stoffregen to support other boards and timers
* Modified by Mitra Ardron
* Added Sanyo and Mitsubishi controllers
* Modified Sony to spot the repeat codes that some Sony‘s send
*
* Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
*/
#include “IRremote.h“
#include “IRremoteInt.h“
// Provides ISR
#include
volatile irparams_t irparams;
// These versions of MATCH MATCH_MARK and MATCH_SPACE are only for debugging.
// To use them set DEBUG in IRremoteInt.h
// Normally macros are used for efficiency
#ifdef DEBUG
int MATCH(int measured int desired) {
Serial.print(“Testing: “);
Serial.print(TICKS_LOW(desired) DEC);
Serial.print(“ <= “);
Serial.print(measured DEC);
Serial.print(“ <= “);
Serial.println(TICKS_HIGH(desired) DEC);
return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}
int MATCH_MARK(int measured_ticks int desired_us) {
Serial.print(“Testing mark “);
Serial.print(measured_ticks * USECPERTICK DEC);
Serial.print(“ vs “);
Serial.print(desired_us DEC);
Serial.print(“: “);
Serial.print(TICKS_LOW(desired_us + MARK_EXCESS) DEC);
Serial.print(“ <= “);
Serial.print(measured_ticks DEC);
Serial.print(“ <= “);
Serial.println(TICKS_HIGH(desired_us + MARK_EXCESS) DEC);
return measured_ticks >= TICKS_LOW(desired_us + MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS);
}
int MATCH_SPACE(int measured_ticks int desired_us) {
Serial.print(“Testing space “);
Serial.print(measured_ticks * USECPERTICK DEC);
Serial.print(“ vs “);
Serial.print(desired_us DEC);
Serial.print(“: “);
Serial.print(TICKS_LOW(desired_us - MARK_EXCESS) DEC);
Serial.print(“ <= “);
Serial.print(measured_ticks DEC);
Serial.print(“ <= “);
Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS) DEC);
return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
}
#endif
void IRsend::sendNEC(unsigned long data int nbits)
{
enableIROut(38);
mark(NEC_HDR_MARK);
space(NEC_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(NEC_BIT_MARK);
space(NEC_ONE_SPACE);
}
else {
mark(NEC_BIT_MARK);
space(NEC_ZERO_SPACE);
}
data <<= 1;
}
mark(NEC_BIT_MARK);
space(0);
}
void IRsend::sendSony(unsigned long data int nbits) {
enableIROut(40);
mark(SONY_HDR_MARK);
space(SONY_HDR_SPACE);
data = data << (32 - nbits);
for (int i = 0; i < nb
相关资源
- arduino uno 控制二自由度舵机云台
- 电子大赛交流文章不用单片机的智能
- 移动onenet 基于arduino IDE 的mqtt连接
- arduino平台下CC2520 zigbee模块的驱动
- ArduinoLED矩阵代码
- Arduino 平衡小车
- LiquidCrystal_I2C驱动Arduino IDE 1.0以上版本
- arduino1602屏幕滚动显示
- PMS5003T Arduino Uno
- Arduino_PS2X库文件
- arduino与Unity串口通讯.docx
- 亚博智能小车光盘资料
- arduino new ping
- 寻迹小车驱动和主控电路图
- 关于12864显示屏与arduino的连接图
- 基于arduino驱动步进电机旋转魔方的全
- GY530-VL53L0X ARDUINO激光测距代码
- MsTimer2.zip
- Arduino 亚博智能平衡小车源码
- Arduino_Uno-原理图
- flexitimer2库
- Arduino 超声波库函数
- arduino 读取温湿度dht11
- arduino电子时钟
- 人体检测模块
- arduino 原理图 PCB
- DallasTemperature,OneWire库
- DS1302的Arduino函数库
- 智能小车完整控制程序
- TB6600步进电机Arduino控制程序
评论
共有 条评论