I have succed with a code sending and one code receiving a message.
When a digital input is high it sends on# and when its low it sends 'off'
But how should i do to transform the message 'on#' to set a digital pin as HIGH output.
Im using Arduino Duemilanove.
#include <VirtualWire.h>
const int led_pin = 4;
const int transmit_pin = 12;
const int receive_pin = 11;
void setup()
{
delay(1000);
Serial.begin(9600);
Serial.println("setup");
vw_set_tx_pin(receive_pin);
vw_setup(2000);
vw_rx_start();
pinMode(led_pin,OUTPUT);
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if(vw_get_message(buf, &buflen))
{
digitalWrite(led_pin,HIGH);
Serial.print("Got ");
for(int i=0; i<buflen; i++)
{
Serial.print(char(buf[i]));
Serial.print(' ');
}
Serial.println();
digitalWrite(led_pin,LOW);
}
}
Thankful for you proffesional help
Bertil