RF Reciever & transmitter [433Mhz, 315Mhz] Library.

Ah now I’m starting to understand your troubles.

I’d STRONGLY suggest you read some C++ 101. Pointers will confuse the crap out of you otherwise.

For your own sanity:

vw_send((uint8_t *)msg, strlen(msg));

Let me break that down. Your message *msg = “hello” means hello is an array of CHAR. Without going into detail (I’m no teacher) * basically means, in this case, make “msg” point to the memory address of “hello”.

Internally lots of the Arduino stuff uses uint8_t instead of char. They are basically the same if you were to look at the memory which makes up that variable. What that line means “I want to look at msg as if it were an array of uint8_t”. uint8_t is just a standard whole number.

As you can probably guess strlne is the string length. The curve ball here is C++ doesn’t understand arrays. All it knows is memory addresses. What vw_send will do is take your msg, which is actually ponting to “h” in “hello” and then read each memory after ‘h’ and stop after “strlen(msg)”.

So basically:

It recives the pointer to ‘h’

‘h’ is now at memory address 10. You’ve told me the array (what’s known as a string) is 4 bytes long (a char is one byte, which is 8 bits). So it’ll read h then e… etc etc

The dangerous thing about c and c++ is vw_send doesn’t realy know what it’s reading from memory! You have to be careful to tell it what to read.

Okay, that’s a little c++ 101. The problem you’re having is char msg is what’s called a constant. That means it CANNOT change. It’s stuck. If you remove that keyword you can then change msg to say what you like.

The problem is, virtualwire gets a little funny when you fiddle with it (I ran into some problems). Without sounding like a broken record, I’d strongly suggest you use HyperCom as that handles all that confusing stuff.

rf.send(“your message”, false); << doesn’t get much more simple than that :wink: