remote_tx.ino: In function 'void loop()':
remote_tx:35: error: invalid conversion from 'char' to 'char*'
remote_tx:35: error: initializing argument 1 of 'void send(char*)'
Please, make all indents consistant. That would make it easier to read for me and for yourself.
In the first line, should there be a space after #include ?
The send() function requires a pointer to a string and you want to transmit a single character. Either make an other function for a single character or create a string from the 'Key'.
I have some questions:
Do you use the newest Arduino software ? Version 1.0.4.
Did you select the right board ?
Did you install the VirtualWire library (in the "libraries" folder next to your projects) ?
About the space after include:
#include<VirtualWire.h> // no space, not good
#include <VirtualWire.h> // with space
If you want to transmit a single character, you could add a function:
void send (char *message)
{
// transmit a string.
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}
void sendChar (char c)
{
// transmit a single character
// Create a pointer to the single character,
// by using the address of the character with: &c
vw_send((uint8_t *) &c, 1);
vw_wait_tx(); // Wait until the whole message is gone
}
I have tested it, and after the changes it compiles.
Thanks for helping me.
I have Arduino ver. 1.5.2(beta)
and selected Arduino Uno from the list, COM port is also correct.
Libraries are installed correctly.
the function provided by you to send a single character worked fine.
now its working
but still not able to send a string using the previous "send" function.
remote_tx.ino: In function 'void loop()':
remote_tx:35: error: invalid conversion from 'char' to 'char*'
remote_tx:35: error: initializing argument 1 of 'void send(char*)'
but still not able to send a string using the previous "send" function.
Because you are NOT trying to send a string. You are STILL trying to send a single character. A string is a NULL terminated array of characters. The minimum length of a string is 0 characters. If the string is to have any meaning, though, it must have at least one character in it. That one character plus a terminating NULL requires TWO elements in an array. You can NOT stick two characters in on char variable.
So, re-write your code to call the function with strings OR rewrite the function to expect a character. Which you do depends on how you make up you mind what you are trying to do.
I had similar problems using this library. After resolving my problems I'm making a tutorial in my new blog. Also in the last part of the tutorial i will so how to send multiple variables using virtualwire.