I'm working a project for uni in which i have to tramsit telementry data (like temp) from a transmitter to a reciever, i understand the basics of using the VirtualWire libary to send hard coded piece of data, what i don't know how to do is to transmit data from a sensor that's on the arduino board:
the generic trasmitter code i have is this:
#include <VirtualWire.h>
const int led_pin = 11;
const int transmit_pin = 12; //Pins will need to be changed
const int receive_pin = 2; //Pins will need to be changed
const int transmit_en_pin = 3; //Pins will need to be changed
void setup()
{
// Initialise the IO and ISR
vw_set_tx_pin(transmit_pin);
vw_set_rx_pin(receive_pin);
vw_set_ptt_pin(transmit_en_pin);
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
}
byte count = 1;
void loop()
{
char msg[7] = {'h','e','l','l','o',' ','#'};
// WANT TO BE ABLE TO SEND SENSOR DATA HERE RATHER THAN HARD CODED BITS OF DATA
msg[6] = count;
digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
vw_send((uint8_t *)msg, 7);
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(led_pin, LOW);
delay(1000);
count = count + 1;
}
If you can post some hints in terms of saying some basic lines of code that would be great
I've already tried to do this project once, and didn't understand it very well so, if the explanations could be as if your talking to a complete newbie when working with the virtualwire and intergrating things that would eb great