Help a newbie with sending variables from arduino

To finalize my project i want a couple of things.

I want to make a .txt file like My_Punching_Data for everyone who installed the app, then store the time the app get's those variables along with the variables itself. like "Time" "text next to my var block".

I want to make the file only once and keep adding the information on it for example i can close the app, not train for days then start again and still don't lose the data from the previous training. I'm afraid i'll program it to overwrite the file but i want to be able to read my first training even after 300 trainings.

Furthermore i want that bottom text to appear for 5 seconds or something. The way i programmed it it will probably print it for just a second then turn blank again (because i'm saying that in an if bytesrecieve = 0)

I've watched several tutorials on these subjects but they are or to basic (storing to .txt) or in Spanish (good clock tutorial), so i can't figure out how to program all this.

Not 100% sure about the text file database yet, but I think that's the best one.

You can use the "join" text block to join the two data. Use the "append to file" block instead of the "save file" block.

Do you happen to have an english version of that xD

1 Like

I corrected. You can also save the data in CSV format. Then you will open the file in excel.

So basicly this is how i can set my current time to the time on my phone, and store all that information like this over and over again right? (I changed MM/dd to dd/MM hope that works correctly because in Holland we swap those)

Hi Brum. Take 5 minutes to study the template (.aia) I supplied you. Should save you time and grey hair getting things working because the devil is in the detail with Bluetooth.

what do you mean with using a bar char?

also what does the /n in your .aia template mean? because it isn't included in the arduino code, does it mean that to indicate i have send all data to print a final /n?

with the can't be 'null' do you mean that i should type for example the /n, then in my code print my var then the /n and after that my other var with another /n?

Hi Brum

This is a bar char: |

It's a good choice when seperating values being sent from Ardunio to an App:

val1 | val2 | val3

The \n in this case means "End of Data", so:

val1 | val2 | val3 \n
(It is explained in my sample App Inventor file, so you lose a brownie point :koala: )

In the Sketch, \n is represented in Serial Comms by Serial.println(); (also explained in my sample Sketch, so that's another brownie point lost :koala: :koala: )

I recently got my bluetooth module but the app won't print what I want.

Inside my app it prints this

The companion shows this

(also tried the -1 instead of bytesavailabletorecieve, but won't work either)

I used a voltage divider with 1k ohms from TX of arduino to a 2k ohms which is connected to ground and in de middle i connected my RX pin of my HC05 to give the bluetooth module the 3.3V signal.

I don't understand why it doesn't work correctly my arduino just prints for example 70|10.00|4101.39

Let's see your Arduino Sketch Brum. Attach it here with the extension changed from .ino to .txt

Sketch.txt (2.6 KB)

It looks fine. See how you have set this option "HighByteFirst":
New

didn't have that on, i'll go ahead and test it

Oh, there might still be a problem with uart speed. You have 38400 set in the program. By default, BT modules are set to 9600. If you have not changed the speed of the BT module, set it to 9600 in the program.

i'm trying to use in another sketch the at command at a baudrate of 38400 and that won't even work if you mean that, currently investigating why that is

void setup()
{
Serial.begin(9600);
pinMode(PunchButton, INPUT);
delay(500);
}

i have read that they normaly are at 38400 but that isn't true then? well read is watched youtube excually

The hc-05, hc-06, and xm-15b modules I had set were 9600 by default.

well that worked, thanks a lot!!!

but still don't understand how to change the standard bautrate because it isnt responding to the AT command