Timeline for How to send multiple data from PC to arduino
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 8, 2017 at 16:29 | history | edited | James Waldby - jwpat7 | CC BY-SA 3.0 |
Edit 2
|
May 8, 2017 at 12:30 | comment | added | kaisar Great |
I used the above code you give and add some inside the case here is for case a : WATEREQFORN1 = val; EEPROM.put(0, WATEREQFORN1); case b : WATEREQFORN2 = val; EEPROM.put(1, WATEREQFORN2); case d : DELAY = val; EEPROM.put(3, DELAY); but when i change the value of A , then change the value of B the value on A will also change in random numbers .. how could i achieve writing into eeprom without changing some that i already save in there ..
|
|
May 7, 2017 at 18:43 | comment | added | James Waldby - jwpat7 |
@kaisarGreat, you could write a recordData() function, that when called will write indicated data to EEPROM if the value has changed. In setup() , load data from where you stored it. For data validation, you can store in cell after a value v its complement, ~v; if you load data and it fails the validation test, then write a default value to EEPROM.
|
|
May 7, 2017 at 17:25 | comment | added | kaisar Great | Sir is it possible to save the value send example 200,400A .. then spilt 200 to val1 and 400 to val2 and save them into different variables but remains when the power of arduino is put out . | |
Nov 11, 2016 at 12:45 | comment | added | kaisar Great | Sir @jwpat7 I want to upvote your answer but my reputation is less 15 :D Thanks for the additional Information. | |
Nov 10, 2016 at 18:18 | comment | added | James Waldby - jwpat7 | @kaisarGreat, please feel free to upvote answer | |
Nov 10, 2016 at 18:17 | comment | added | James Waldby - jwpat7 |
Also, if you need to know whether a number for val1 has been specified -- that is, if you handle items like 500B as well as 300,500B -- you can set/test/clear a flag: case ',': val1=val; v1flag=1; break; .... case 'B': if (!v1flag) val1=val1default; Serial.print("B stuff with val and val1"); v1flag=0; break;
|
|
Nov 10, 2016 at 15:46 | comment | added | kaisar Great | I did what you told sir @jwapat7 , I add 'case ',': val1=val; break' then in the both 'case 'a'' and 'b' I add 'Serial.println(val1);' and It works like a charm :) Thanks for your quick reply . | |
Nov 10, 2016 at 5:18 | comment | added | James Waldby - jwpat7 |
Yes, you can do that, but handling numbers in pairs complicates the parsing – it's simpler and easier to handle independent values. ¶ That said, one approach is to add case ',': val1=val; break; into the switch , and then when you get the A or B (for a form like 200,300A or 200,300B ) do an action using both val1 and val . That is, the action for the comma case stores a value for future use; while letter cases can use two vals.
|
|
Nov 10, 2016 at 4:36 | comment | added | kaisar Great | Sir @jwpat7 is it posible to combine the snippet code above you give and one approach you give the sending numbers in pair ? Example I will send 200A300 or 200,300A then put them in separate varables .. 200B300 or 200,300B .. | |
Nov 3, 2016 at 19:28 | comment | added | kaisar Great | Thank You Sir :D for your help and time :) @jwpat7 it really help me :D | |
Nov 3, 2016 at 19:23 | comment | added | James Waldby - jwpat7 | @kaisarGreat, see edit for working example | |
Nov 3, 2016 at 19:23 | history | edited | James Waldby - jwpat7 | CC BY-SA 3.0 |
add code example
|
Nov 3, 2016 at 18:48 | comment | added | kaisar Great | Can you give me a code snippet C programing language on how to pick up digits until a letter appears and make an if else condition based on the letter :D Thanks a lot | |
Nov 3, 2016 at 18:47 | vote | accept | kaisar Great | ||
Nov 3, 2016 at 18:11 | history | answered | James Waldby - jwpat7 | CC BY-SA 3.0 |