资源简介
基因arduino的平衡小车代码,使用MPU6050获取原始数据,使用三角函数和卡尔曼滤波获取姿态,使用PID算法计算电机PWM。
代码片段和文件信息
// I2Cdev library collection - Main I2C device class
// Abstracts bit and byte I2C R/W functions into a convenient class
// 11/1/2011 by Jeff Rowberg
//
// Changelog:
// 2011-11-01 - fix write*Bits mask calculation (thanks sasquatch @ Arduino forums)
// 2011-10-03 - added automatic Arduino version detection for ease of use
// 2011-10-02 - added Gene Knight‘s NBWire TwoWire class implementation with small modifications
// 2011-08-31 - added support for Arduino 1.0 Wire library (methods are different from 0.x)
// 2011-08-03 - added optional timeout parameter to read* methods to easily change from default
// 2011-08-02 - added support for 16-bit registers
// - fixed incorrect Doxygen comments on some methods
// - added timeout value for read operations (thanks mem @ Arduino forums)
// 2011-07-30 - changed read/write function structures to return success or byte counts
// - made all methods static for multi-device memory savings
// 2011-07-28 - initial release
/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2011 Jeff Rowberg
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/
#include “I2Cdev.h“
#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE
// NBWire implementation based heavily on code by Gene Knight
// Originally posted on the Arduino forum at http://arduino.cc/forum/index.php/topic70705.0.html
// Originally offered to the i2cdevlib project at http://arduino.cc/forum/index.php/topic68210.30.html
TwoWire Wire;
#endif
/** Default constructor.
*/
I2Cdev::I2Cdev() {
}
/** Read a single bit from an 8-bit device register.
* @param devAddr I2C slave device address
* @param regAddr Register regAddr to read from
* @param bitNum Bit position to read (0-7)
* @param data Container for single bit value
* @param timeout Optional read timeout
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-01-06 17:22 BalanceCar\
文件 6942 2016-01-05 12:08 BalanceCar\BalanceCar.ino
文件 3276 2016-01-05 10:39 BalanceCar\BalanceCar.vcxproj
文件 823 2016-01-05 10:39 BalanceCar\BalanceCar.vcxproj.filters
目录 0 2016-01-06 17:22 BalanceCar\MPU6050\
文件 39916 2011-11-09 21:15 BalanceCar\MPU6050\I2Cdev.cpp
文件 9792 2011-11-09 21:15 BalanceCar\MPU6050\I2Cdev.h
文件 122085 2011-11-09 21:15 BalanceCar\MPU6050\MPU6050.cpp
文件 45436 2011-11-09 21:15 BalanceCar\MPU6050\MPU6050.h
目录 0 2016-01-06 17:22 BalanceCar\__vm\
文件 2772 2016-01-05 10:39 BalanceCar\__vm\.BalanceCar.vsarduino.h
- 上一篇:MT4软件 MACD双线指标
- 下一篇:基于AD9850的信号发生器的设计与实现
评论
共有 条评论