C编程如何找到事件之间的时间间隔

发布于 2024-08-03 19:41:18 字数 114 浏览 4 评论 0原文

我使用手写板和交互式 C 软件,任务是使用车轮上的红外“光束”传感器实时查找乐高电机的转速。我正在考虑找到光束被破坏之间的时间间隔,然后从那里计算转速,但我无法确切地弄清楚如何做到这一点。任何帮助将不胜感激,谢谢。

Im using a handyboard and interactive c software and the task is to find the rpm of a lego motor in real time using an Infrared "Break Beam" Sensor on the wheel. I was thinking about finding the time interval between the beam being broken and then from there calculating the rpm but i cant figure out exactly how to do that. Any help would be much appreciated thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酒浓于脸红 2024-08-10 19:41:18

确实是这样的意思: http://www.cplusplus.com/reference/clibrary/ctime /

我相信有更好的解决方案(正如尼尔所暗示的那样),但这是最简单的。

Do mean something like this: http://www.cplusplus.com/reference/clibrary/ctime/

I believe there a better resolution ones out there (as Neil is implying), but this is the simplest.

固执像三岁 2024-08-10 19:41:18

If you have access to Win32 then you can use QueryPerformanceFrequency to calculate the time of the interval. It's also often being used to determine the amount of frames per seconds in games, so it's very precise.

夏有森光若流苏 2024-08-10 19:41:18

我自己有一个方便的板,因为你使用的是 v9 电机,不是吗?
我相信您可以根据施加到电机上的电压来计算它。
另外一个很好的参考,机器人探索

I have a handy board myself, since you are using a v9 motor, arent you?
I am sure you could jsut calculate it from the voltage thats being applied to the motor.
Additionally a good reference, Robotic Exploration

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文