资源简介
4足机器人源码,具体的制作可以参考我的博文,压缩包里还包含了我做出来的gif图,除了打印出来的模型,还需要arduino UNO板,还需要一块16路的PMW驱动板,8个小舵机(TB上最便宜的那种9g电机)一个四触点的摇杆。代码需要稍加修改。最终完成的动作和摇杆的控制需要自己稍微修改代码,很容易。
代码片段和文件信息
/***************************************************
This is a library for our Adafruit 16-channel PWM & Servo driver
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/products/815
These displays use I2C to communicate 2 pins are required to
interface. For Arduino UNOs thats SCL -> Analog 5 SDA -> Analog 4
Adafruit invests time and resources providing this open source code
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license all text above must be included in any redistribution
****************************************************/
#include
#include
#if defined(__AVR__)
#define WIRE Wire
#elif defined(CORE_TEENSY) // Teensy boards
#define WIRE Wire
#else // Arduino Due
#define WIRE Wire1
#endif
// Set to true to print some debug messages or false to disable them.
#define ENABLE_DEBUG_OUTPUT true
Adafruit_PWMServoDriver::Adafruit_PWMServoDriver(uint8_t addr) {
_i2caddr = addr;
}
void Adafruit_PWMServoDriver::begin(void) {
WIRE.begin();
reset();
}
void Adafruit_PWMServoDriver::reset(void) {
write8(PCA9685_MODE1 0x0);
}
void Adafruit_PWMServoDriver::setPWMFreq(float freq) {
//Serial.print(“Attempting to set freq “);
//Serial.println(freq);
freq *= 0.9; // Correct for overshoot in the frequency setting (see issue #11).
float prescaleval = 25000000;
prescaleval /= 4096;
prescaleval /= freq;
prescaleval -= 1;
if (ENABLE_DEBUG_OUTPUT) {
Serial.print(“Estimated pre-scale: “); Serial.println(prescaleval);
}
uint8_t prescale = floor(prescaleval + 0.5);
if (ENABLE_DEBUG_OUTPUT) {
Serial.print(“Final pre-scale: “); Serial.println(prescale);
}
uint8_t oldmode = read8(PCA9685_MODE1);
uint8_t newmode = (oldmode&0x7F) | 0x10; // sleep
write8(PCA9685_MODE1 newmode); // go to sleep
write8(PCA9685_PRESCALE prescale); // set the prescaler
write8(PCA9685_MODE1 oldmode);
delay(5);
write8(PCA9685_MODE1 oldmode | 0xa1); // This sets the MODE1 register to turn on auto increment.
// This is why the beginTransmission below was not working.
// Serial.print(“Mode now 0x“); Serial.println(read8(PCA9685_MODE1) HEX);
}
void Adafruit_PWMServoDriver::setPWM(uint8_t num uint16_t on uint16_t off) {
//Serial.print(“Setting PWM “); Serial.print(num); Serial.print(“: “); Serial.print(on); Serial.print(“->“); Serial.println(off);
WIRE.beginTransmission(_i2caddr);
WIRE.write(LED0_ON_L+4*num);
WIRE.write(on);
WIRE.write(on>>8);
WIRE.write(off);
WIRE.write(off>>8);
WIRE.endTransmission();
}
// Sets pin without having to deal with on/off tick placement and properly handles
// a zero value as completely off. Optional invert parameter supports inverting
// the pulse for sinking to ground. Val should be a value from 0 to 4095 inclusive.
void Adafruit_PWMServoD
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1945980 2015-10-08 21:09 四足机器人源码\16路PWM\adafruit-16-channel-pwm-slash-servo-shield.pdf
文件 4045 2014-08-16 09:28 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\Adafruit_PWMServoDriver.cpp
文件 1576 2014-08-16 09:28 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\Adafruit_PWMServoDriver.h
文件 1755 2014-08-16 09:28 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\examples\pwmtest\pwmtest.pde
文件 6177 2017-03-23 15:53 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\examples\servo\servo.ino
文件 1499 2014-08-16 09:28 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\license.txt
文件 1031 2014-08-16 09:28 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\README.md
文件 7766 2015-03-25 17:01 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary.zip
文件 1636427 2017-03-22 20:19 四足机器人源码\图片\555555.gif
文件 14788791 2017-03-22 20:08 四足机器人源码\图片\GIF2.gif
文件 3351568 2017-03-22 20:09 四足机器人源码\图片\GIF3.gif
文件 266063 2017-03-22 19:56 四足机器人源码\图片\wx_camera__clip.gif
文件 1871596 2017-03-22 20:13 四足机器人源码\图片\zhuanshen.gif
文件 196 2017-03-10 19:24 四足机器人源码\机器人所需螺丝.txt
文件 9757 2015-12-08 22:19 四足机器人源码\源代码(The_Social_Quadruped)\The_Social_Quadruped\Quad_Functions.ino
文件 2814 2015-12-08 23:27 四足机器人源码\源代码(The_Social_Quadruped)\The_Social_Quadruped\The_Social_Quadruped.ino
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\examples\pwmtest
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\examples\servo
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary\examples
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary\AdafruitPWMServoDriverLibrary
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM\AdafruitPWMServoDriverLibrary
目录 0 2017-09-01 08:41 四足机器人源码\源代码(The_Social_Quadruped)\The_Social_Quadruped
目录 0 2017-09-01 08:43 四足机器人源码\16路PWM
目录 0 2017-09-01 08:41 四足机器人源码\图片
目录 0 2017-09-01 08:43 四足机器人源码\源代码(The_Social_Quadruped)
目录 0 2017-09-01 08:46 四足机器人源码
----------- --------- ---------- ----- ----
23897041 26
相关资源
- Arduino UNO R3+MSGEQ7+RGB灯带.zip
- esp8266 V2.5.2--arduino IDE添加esp8266开发板
- arduino1.0.1中文版
- Arduino编程指南-75个智能硬件程序设计
- Arduino面包板连线绘图软件
- Arduino IDE for esp 8266开发版最新官方安
- 物联网智能家居平台DIY:ARDUINO 物联网
- Arduino六自由度总线机械臂组装,控制
- 按键控制步进电机正反转
- Arduino 中文资料 pdf
- labview温湿度报警器
- arduino激光雕刻机
- 35个ARDUINO制作项目
- Arduino+ESP8266库文件
- solidworks电路板三维,包含arduino2560、
- 智能电子秤arduino+hx711+DS1302+dh11+lcd16
- 电赛F题纸张计数显示装置全套资料打
- esp8266-2.7.2 离线安装包.zip
- fritzing软件,解压可直接运行,win64
- UARM开源整理.rar
- Arduino程序设计基础pdf
- arduino案例实战李永华
- 《Arduino与LabVIEW开发实战》PDF 电子书
- ARDUINO程序设计基础和Arduino权威指南中
- SIM800C模块,gsm模块资料,手册,原理
- AD9959的arduino操作程序~~~
- 基于单片机的便携式老年人跌倒报警
- Arduino 无源蜂鸣器 音乐播放实验
- Arduino教程:MPU6050的数据获取、分析与
- Arduino温度报警器
评论
共有 条评论