Arduino教程(提高篇)——SR04超声波类库的使用-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

楼主: 奈何col

Arduino教程(提高篇)——SR04超声波类库的使用

  [复制链接]
发表于 2015-11-4 13:52 | 显示全部楼层
哈哈。有教材很好,楼主写的也很明白,赞一个
发表于 2015-11-5 13:47 | 显示全部楼层
完全按照教程来接线和写代码(不是用类库),只有第一次出数据(距离还比较准),后面都是0.00cm,求教

Ultrasonic sensor:
194.66cm
0.00cm
0.00cm
0.00cm
0.00cm
0.00cm
发表于 2015-11-7 13:21 | 显示全部楼层
mapig 发表于 2013-1-2 23:17
**** 作者被禁止或删除 内容自动屏蔽 ****

查下电平,我一开始接3.3V全是0
发表于 2016-1-6 12:58 | 显示全部楼层
yincp 发表于 2015-11-5 13:47
完全按照教程来接线和写代码(不是用类库),只有第一次出数据(距离还比较准),后面都是0.00cm,求教

Ul ...

吹吹那个探头就好了。。。。
发表于 2016-1-7 09:57 来自手机 | 显示全部楼层
您好,我想请教一下如何用超声波模块控制舵机使其在120度范围内来回转?
发表于 2016-1-21 13:56 | 显示全部楼层
有库真好,谢谢分享
发表于 2016-1-31 22:27 | 显示全部楼层
我按照上面所说的做了,但是编译不通过,为什么呢?出现这个
Arduino:1.6.2 (Windows 7), 板:"Arduino Uno"

构建选项已变更,全部重新构建

sketch_jan31b.ino: In function 'void loop()':

sketch_jan31b.ino:24:14: error: no matching function for call to 'HardwareSerial::print()'

sketch_jan31b.ino:24:14: note: candidates are:

In file included from C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Stream.h:26:0,

                 from C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/HardwareSerial.h:29,

                 from C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Arduino.h:223,

                 from sketch_jan31b.ino:1:

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:58:12: note: size_t Print::print(const __FlashStringHelper*)

     size_t print(const __FlashStringHelper *);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:58:12: note:   candidate expects 1 argument, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:59:12: note: size_t Print::print(const String&)

     size_t print(const String &);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:59:12: note:   candidate expects 1 argument, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:60:12: note: size_t Print::print(const char*)

     size_t print(const char[]);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:60:12: note:   candidate expects 1 argument, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:61:12: note: size_t Print::print(char)

     size_t print(char);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:61:12: note:   candidate expects 1 argument, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:62:12: note: size_t Print::print(unsigned char, int)

     size_t print(unsigned char, int = DEC);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:62:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:63:12: note: size_t Print::print(int, int)

     size_t print(int, int = DEC);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:63:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:64:12: note: size_t Print::print(unsigned int, int)

     size_t print(unsigned int, int = DEC);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:64:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:65:12: note: size_t Print::print(long int, int)

     size_t print(long, int = DEC);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:65:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:66:12: note: size_t Print::print(long unsigned int, int)

     size_t print(unsigned long, int = DEC);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:66:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:67:12: note: size_t Print::print(double, int)

     size_t print(double, int = 2);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:67:12: note:   candidate expects 2 arguments, 0 provided

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:68:12: note: size_t Print::print(const Printable&)

     size_t print(const Printable&);

            ^

C:\Users\Administrator\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/Print.h:68:12: note:   candidate expects 1 argument, 0 provided

编译有误。

  报告将会包含更多的信息
  "在编译时,输出详细信息"
  在 文件>首选项 中启用
发表于 2016-3-3 17:03 | 显示全部楼层
太好了,双手赞成大家都开放类库文件,发扬协作精神。
发表于 2016-3-13 17:18 | 显示全部楼层
洪雨 发表于 2012-8-9 22:20
不知道最远都到多远 我试了下 两栋楼之间的距离 收不到 能收到 500cm以内的 不知道大家有没有测过最远的距 ...

SR04测距是2cm-400cm
发表于 2016-3-30 16:05 | 显示全部楼层
留名 !必须支持下 !!!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-12-27 22:55 , Processed in 0.108273 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表