Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

arduino serial read write structure

void send (const structTable* table)
{
    Serial.write((const char*)table, sizeof(structTable));  // 2 bytes.
}

bool receive(structTable* table)
{
    return (Serial.readBytes((char*)table, sizeof(structTable)) == sizeof(structTable));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #arduino #serial #read #write #structure
ADD COMMENT
Topic
Name
4+9 =