0

I am receiving uint8_t bytes from arduino to android, using bluetooth. I am displaying a log on the screen. Two things I need to do that I can't find out how to perform.

1-

I want to store each uint8_t, do some math on it, and output another log under it.

Example:

Left: 16
Right: (Left/2)

How would I go about displaying storing Left and then displaying Right (And also storing Right)?

2-

Once the connection is cut, I have a line at the top with an identifier, and a save button on the right. Say I input 1234 as identifier and hit save, I want the android app to save a file with the log, as xml or something, called 1234.xml. How would I go about doing that?

I tried searching for it, but bluetooth searches result in making the connection, not on how to then store the data. Help is much appreciated!

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
belgarion
  • 115
  • 1
  • 11
  • Store data where? Are you asking about simple variable assignment? – OneCricketeer Nov 20 '16 at 02:06
  • Ok sure, variable assignment, didn't know you could assign variables to a stream of bytes coming in. How would you go about doing that? – belgarion Nov 20 '16 at 02:40
  • Well, `byte[]` is the data type. You are reading from Sockets, I assume, and are able to attach some form of a stream reader to that, then you can receive Strings. Refer to this post. http://stackoverflow.com/questions/6684665/java-byte-array-to-string-to-byte-array – OneCricketeer Nov 20 '16 at 02:49
  • What am I supposed to understand from it? I don't know what part to store where, because I don't have anything to store. Example: If I defined a variable x=3. I could say y=x. I just stored 3 into y. However, now, I don't have an x=3 to store into y, because it comes from bluetooth data being sent. I'm receiving bytes in the form of uint8_t (C programming from arduino)... so I don't know what to store where... – belgarion Nov 20 '16 at 03:50
  • "I'm receiving bytes" -- Yes. How are you doing that? Please [edit] with some code. – OneCricketeer Nov 20 '16 at 03:57

0 Answers0