Trouble Sending a struct using RH_ASK and 433 rf

Hello, I am trying to send a struct over 433 RF. Problem is....
it hangs at "driver.send((uint8_t*)&MyData,sizeof(MyData));".

I may have my data types mixed up...

I am kinda new to programing,
please help.

Struct_RF_Tansmit.ino (645 Bytes)

#include <RH_ASK.h>
#include <SPI.h>

RH_ASK driver(4000, 11, 12);

struct My_Data {int Val_1;int Val_2;int Val_3;};
struct My_Data MyData;

void setup()
{
Serial.begin(9600);
}

void loop()
{
MyData.Val_1 = 456;
MyData.Val_2 = 789;
MyData.Val_3 = 789;
Serial.print("Val_1 = "); Serial.println(MyData.Val_1);
Serial.print("Val_2 = "); Serial.println(MyData.Val_2);
Serial.print("Val_3 = "); Serial.println(MyData.Val_3);

driver.send((uint8_t*)&MyData,sizeof(MyData));
driver.waitPacketSent();
Serial.println(sizeof(MyData));
Serial.println("Data Sent");
delay(10000);
}

Add to setup()

 driver.init();

Why do you need SPI.h?

Thank You! It worked!

SPI.h was in the example, i guess i don't need it, Thanks!

now... how would i receive and fill the struct?
i know that i need to create the same struct on the receiving end but not sure how to fill it.
thanks again for all the help.

i know that i need to create the same struct on the receiving end but not sure how to fill it.

Try

driver.recv((uint8_t*)&myReceivedStruct, sizeof(myReceivedStruct))

Thank You! Thank You! Thank You!
Works perfect!

You Are Awesome "cattledog"