#include <pb.h>
#include <pb_decode.h>
#include <pb_encode.h>
#include <message.pb.h>
Simple msg;
uint8_t buffer[64];
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
void setup(){
Serial.begin(9600);
//Set the name field of the Simple struct to "Example Message", and
//set the has_name field to true.
strncpy(msg.name,"Hello",sizeof(msg.name));
msg.has_name = true;
//Serialize the Simple message and pack it into the buffer.
pb_encode(&stream, Simple_fields, &msg);
}
void loop(){
int bytes_sent = Serial.write(buffer, stream.bytes_written);
delay(3000);
}
Completed.