No.93365 作者:liufengzhong 邮件:l_fz@sina.com ID:149522 登陆:12次 文章数:695篇 最后登陆IP:183.13.93.245 最后登陆:2015/6/16 17:02:27 注册:2014/7/29 21:51:15 财富:3671 发帖时间:2014/9/17 10:50:27 发贴者IP:14.125.35.175 标题:liufengzhong:超声波距离模块HC-SR04 摘要:No.93365超声波距离模块HC-SR04 状态:beta 下载: 0 许可证: 最后更新:12个/ 1月/ 2014 05:26点 Wiki条目: 项目概述 超声波距离模块HC-SR04是避障和测距的爱好者的欢迎。 Arduino是常用的。 我已经使用它与Arduino和RaspberryPi。 我最近收到了startKIT和正在寻找一个快速学习项目为intefacing传感器。 所以,焊头针后,我联系了HC-SR04。 下面的示例代码运行好xTIMEcomposerStudio. /* Quick test for using the HC-SR04 Ultrasonic Distance Sensor * HC-SR04 is a 5V device * Used a voltage divider on Echo to bring down to 3.3V * app_HC-SR04.xc * * Created on: Jan 5, 2014 * Author: NickE */ #include <xs1.h> #include <timer.h> #include <stdio.h> in port inP = XS1_PORT_1I; //Echo - Pin D24 out port outP = XS1_PORT_1O; //Trigger - Pin D25 int echo_time(void){ timer t; //10ns increments unsigned int start_time,stop_time; outP <: 0; ......
>>返回讨论的主题
|