Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old December 29th, 2012, 11:23 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default Bluetooth Protocol

Hello, I am developing an app that will use bluetooth and return values to an app. I am having some problems using my Arduino (Uno rev3) Development board to send data to the board from my arduino program. I am using a sample code to test with turning on and off an LED. So far I have tested the Arduino code with its serial monitor to send data and it seems that it accepts sending the "D" letter value. I believe it is accepting its command because it is used to its own protocol of bytes or something similar. I am not sure if I am using the correct command to send data from my android to the arduino here is a snippet of the command to send a capital "D" to turn on a LED:

public class LEDtest extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.ledtest);
final Button tbutton = (Button) findViewById(R.id.tbutton);

tbutton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ConnectedThread.write("D".getBytes());

}
});

}



}
I want to know if there's a command that will change it to to a universal protocol of bytes or if there's something I'm missing.

Advertisements
DIONYZUZ is offline  
Reply With Quote
sponsored links
Old December 30th, 2012, 05:01 PM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

I thought it would work by switching the write function part to:
String S = "D";
ConnectedThread.write(S.getBytes());


But it still didnt work I am aware there are different ways of sending the data via serial such as getString, getAsciiBytes, getAsciiString etc, but they do not work in the same format as this way. I am very lost and do not know how my Arduino will expect recieving the "D" to turn on an LED.
DIONYZUZ is offline  
Reply With Quote
Old January 5th, 2013, 01:58 PM   #3 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

I finally got it working.. I don't think I'll be using this forum anymore :/
DIONYZUZ is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:55 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.