2009-12-28 21:35:00 [显示全部楼层]
4088浏览
查看: 4088|回复: 0

HCR -PC 客户端开源

[复制链接]

admin  管理员

发表于 2009-12-28 21:35:00

HCR -PC 客户端开源

开源的文件连接在Google Code上。装了SVN的可以直接check out。
Encoder Connection Diagram
Encoder Sampling Code ```
const byte encoder0pinA = 2;//A pin -> the interrupt pin 0 const byte encoder0pinB = 4;//B pin -> the digital pin 4 byte encoder0PinALast; int duration;//the number of the pulses boolean Direction;//the rotation direction
void setup() {
Serial.begin(57600);//Initialize the serial port EncoderInit();//Initialize the module }
void loop() { Serial.print("Pulse:"); Serial.println(duration); duration = 0; delay(500); }
void EncoderInit() { Direction = true;//default -> Forward
pinMode(encoder0pinB,INPUT);
attachInterrupt(0, wheelSpeed, CHANGE); }
void wheelSpeed() { int Lstate = digitalRead(encoder0pinA); if((encoder0PinALast == LOW) && Lstate==HIGH) { int val = digitalRead(encoder0pinB); if(val == LOW && Direction) { Direction = false; //Reverse } else if(val == HIGH && !Direction) { Direction = true; //Forward } } encoder0PinALast = Lstate;
if(!Direction) duration++; else duration--; }
```
Open source home care robot from roboticfan.com
欢迎大家看一下chai2010撰写的关于SVN的使用教程。非常浅显易懂!

希望大家能在这基础上完善更新
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail