从Arduino发送数据和事件到手机

发布于 2024-12-09 17:54:00 字数 401 浏览 0 评论 0原文

我是新手,之前没有 arduino 或微控制器编程经验。对于我的一个课程项目,我需要通过蓝牙将数据/消息/事件从arduino发送到我的手机(比如android),因为arduino板将有一个外部按钮/开关,按下该按钮/开关时应将事件发送到我的手机Android 手机上的应用程序。

我做了一些谷歌搜索,发现 Arduino BT 和 amarino 作为我的项目的正确选择。然后还有 BTShield v1.1,这是一个便宜的替代方案(但我不确定接口)。话虽如此,任何人都可以给我一些关于蓝牙编程部分和蓝牙编程的指导吗?有关如何执行此操作的一些示例代码。另外,是否可以在 arduino 板上嵌入按钮/开关之类的东西以及 as & ?当按下时,我的 Android 应用程序是否可以检测到该按下事件?

任何帮助将不胜感激。

谢谢。

I'm a newbie and have no prior experience with arduino or microcontroller programming. For one of my course project, i need to send data/message/event from the arduino to my mobile phone (say android) via bluetooth as in the arduino board will have an external button/switch which when pressed should send an event to my application on android phone.

I did some googling and found Arduino BT and amarino as the right option for my project. And then there is BTShield v1.1 which is a cheap alternative (but i'm not sure about the interfacing). having said that, can anyone plz give me some pointers on the bluetooth programming part & some example codes on how to do this. Also, is it possible to embed a button/switch like stuff on the arduino board and as & when pressed, would it be possible for my android application to detect that press event?

Any help will be appreciated.

Thank you.

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

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

发布评论

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

评论(1

北凤男飞 2024-12-16 17:54:00

我建议您阅读这些教程:

http://www.amarino-toolkit.net /index.php/tutorials.html

您不必先学习蓝牙编程。阿马里诺已经为您做了很多事情。

如果你想从 Arduino 收到一些东西。

在android部分,你只需

registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));
Amarino.connect(this, DEVICE_ADDRESS); 

制作一个接收器并告诉你的android意图,连接到你的蓝牙模块,覆盖ArduinoReceiver类中的onReceive方法...

你放置的Arduino部分

meetAndroid.receive(); // put in loop()
meetAndroid.send("data you want to send");    

要从Android接收事件并发送到Android...

我强烈推荐你完成这些教程。

I recommend you to read these tutorials:

http://www.amarino-toolkit.net/index.php/tutorials.html

You don't have to learn Bluetooth programming first. Amarino already done many things for you.

If you wanna receive something from Arduino.

In android part you just

registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));
Amarino.connect(this, DEVICE_ADDRESS); 

Make a receiver and tell your android intent, Connect to your bluetooth module, override the onReceive method in ArduinoReceiver class...

Arduino part you put

meetAndroid.receive(); // put in loop()
meetAndroid.send("data you want to send");    

To receive events from Android and send to Android...

I highly recommend you go through these tutorials.

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