Hello all, I am kinda new to the arduino and have looked all over the net to see what would be the best way to solve my situation. I have written a c# module that controls the hvac system in my vehicle. The c# code is complete and functions as it should. My question is, what is the best way to send my variable info to the arduino to control two servos and three relays. The c# code stores each variable in a binary file. There are only three variables, fan, temp and mode. I needed to store the variables to file, so that each time the vehicle is started the hvac returns to the last state it was in when the vehicle was turned off. My question is, what is the best way to send and receive each varible to arduino? My variables are intergers, fan is always going to be 1 digit, temp is always 2 digits and mode is 1 digit. Fan is 0 thru 3, temp is 60 thru 90 and mode is 5 thru 12. My options are, I can send each variable separately, I can send as comma delimited (3,60,8) or can I simply just read the binary file into arduino sketch? Everything I have found doesn't talk very much about serial read as int, I don't want to convert them to strings if I don't have to. Any advice would be greatly appreciated.
You don't want to convert to string so comma separated values do not really make sense.
Be aware of the size of your variables, an int in most arduinos is 16 bits. Be aware of little endian versus big endian (no idea who uses what).
I would use comma-separated-values unless I needed the extra speed that binary data provides. See the 3rd example in Serial Input Basics.
It is much easier to debug the programs if you send data in human readable form.