使用Processing绘制鼠标的xy坐标图

发布于 2024-09-24 13:32:39 字数 229 浏览 2 评论 0原文

我发现这个非常酷的网站将 Arduino 连接到光电鼠标以从中读取 xy 读数。我已经做到了,而且效果很好。

然后我在想,“为什么不将所有这些绘制成图表呢?”我遇到了处理。

我知道处理有一个名为“MouseSignal”的示例,

这个示例正是我想用处理编写的东西。但是,唯一的变化是,我想使用连接到 Arduino 的鼠标的 xy 坐标,并要求处理生成坐标的“实时”图表。

谢谢!

I've found this really cool site on interfacing an Arduino to an optical mouse to read out x-y readings from it. I've done it, and it's working nicely.

Then I was thinking, 'Why not plot all this to become a graph?' and I came across Processing.

I am aware that Processing has an example named 'MouseSignal'

This example is the EXACT thing that I want to write with Processing. But, the only change is that, I want to use the x-y coordinates from the mouse that is attached to the Arduino and ask Processing to generate a 'real-time' graph of the coordinate.

Thanks!

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

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

发布评论

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

评论(1

鹿! 2024-10-01 13:32:39

更改代码中的位置:

xvals[width-1] = mouseX; 
yvals[width-1] = mouseY;

mouseXmouseY 替换为来自 Arduino 的值。您可能需要缩放这些值以适合轴。

Change the spot in the code where it says:

xvals[width-1] = mouseX; 
yvals[width-1] = mouseY;

Replace mouseX and mouseY with the values coming from the Arduino. You may need to scale these values to fit within the axes.

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