开发者

Sending data and event from Arduino to mobile phone

开发者 https://www.devze.com 2023-04-13 09:57 出处:网络
I\'m a newbie and have no prior experience with arduino or microcontrolle开发者_运维技巧r programming. For one of my course project, i need to send data/message/event from the arduino to my mobile pho

I'm a newbie and have no prior experience with arduino or microcontrolle开发者_运维技巧r 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号