This is not working obviously its too long a string
So heres my code.
Im sending from vvvv.
char packetBuffer[290];
void loop() {
if (Serial.available() > 0)
{
Serial.readBytes(packetBuffer,numOutputs + 2);// 6 is the packetsize
if( packetBuffer[0]=='<' && packetBuffer[numOutputs + 2 -1]=='>')
{
unsigned char val[numOutputs];
memcpy(val,packetBuffer+1,numOutputs);
///////////Now we have a clean input buffer of 4 bytes to use.
for ( int i=0; i < numOutputs ; i++ )
{
//ShiftPWM.SetRGB(i,val[i*3],val[(i*3)+1],val[(i*3)+2]);
ShiftPWM.SetOne(i,val[i]);
}
So my questions
So what is the maximum amount of chars i can send through and what spec of the arduino tells me that.
I dont need an 8 bit resolution really.
Could i just send just the bits i need , and convert in arduino ? maybe four for each value ?
Library is using some timers that i cannot wrap my head around how to convert for mega or Due.
Maybe someone knows ?
i just went through Robins serial post.
i think it makes sense.
My install works fine at a lower baurate, but arduino is acting weird when i increase it.
I assumed this is overflowing buffer from the big length of the string.
as long as you set aside enough space for it.
what exactly do you mean ?
But what is the issue really, is it arduinos memory not enough to store the 300 char characters in one loop ?
i need to refresh that string 15 times per second or so.
But what is the issue really, is it arduinos memory not enough to store the 300 char characters in one loop ?
Sure, but loop() can iterate thousands of time a second. Serial data can NOT arrive that fast. The serial buffer is only 64 characters. Another thing to keep in mind.
@charlesdavis my array is char already, or am i not getting you. @PaulS so if i delay the loop to my desired framerate would arduino manage the serial buffer then properly to fit all the characters ?
@PaulS so if i delay the loop to my desired framerate would arduino manage the serial buffer then properly to fit all the characters ?
Don't EVEN think of that. Read and store data as fast as possible. When ALL the data has arrived, by whatever means you use to determine that that has happened, use the data.