How can i store serial received data values in a Integer array?
I'm sending a message like this "c;1;2;3;4" to the Arduino.
"c" means the command / action
1;2;3;4 are the values that arudino should process
The message length can differ.
At the moment i have this code:
// This example sets all the values of the digital pins with a list through a callback function
#include <Messenger.h>
// Instantiate Messenger object with the default separator (the space character)
Messenger message = Messenger(',');// Create the callback function
void messageReady()
{
if ( message.checkString("c") )
{
// Loop through all the available elements of the message
while ( message.available() )
{
int value = message.readInt();Serial.println(value);
}
}
else if
{
if ( message.checkString("PING") )
Serial.println("ACK");
}
else
//falls es eine message für die es kein handling gibt
message.readInt();
}void setup() {
// Initiate Serial Communication
Serial.begin(115200);
// Attach the callback function to the Messenger
message.attach(messageReady);
}void loop() {
// The following line is the most effective way of using Serial and Messenger's callback
while ( Serial.available() ) message.process(Serial.read () );
}
The problem is that i don't know how to add the received values into a Integer array.
Can someone help?
thx a lot