Hello, I am creating a weather station and am having trouble with the programs I use. whenever I upload the code there are no error messages, but I am getting nothing in my serial monitor and my led never flashes for a received message.
Currently, my transmit program is:
pinMode(13,OUTPUT); // Testing Indicator setup
pinMode(12,OUTPUT); // Default transmitter pin for headsup
vw_set_ptt_inverted(true);
vw_setup(2000);
vw_set_tx_pin(12); // Radio Setup
if (!bme.begin()) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
bme.readSensor();
temp = bme.getTemperature_F();
tempc = bme.getTemperature_C();
pressure = bme.getPressure_MB();
humidity = bme.getHumidity();
sprintf(Array, "%d,%d,%d.",temp,tempc,pressure,humidity);
vw_send((uint8_t*)Array, strlen(Array));
vw_wait_tx();
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
and my Receive program is:
#include <VirtualWire.h>
uint8_t data[25];
void setup() {
Serial.begin(9600);
vw_setup(2000);
vw_set_rx_pin(12);
vw_set_ptt_inverted(true);
vw_rx_start();
pinMode(13,OUTPUT);
}
void loop() {
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)){// Non-blocking
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
int temp = atoi(strtok((char*)buf, ","));
int tempc = atoi(strtok(NULL, ","));
int pressure = atoi(strtok(NULL, ","));
int humidity = atoi(strtok(NULL, "."));
Serial.print(temp);
Serial.print(", ");
Serial.print(tempc);
Serial.print(", ");
Serial.print(pressure);
Serial.print(", ");
Serial.print(humidity);
Serial.println();
}
}
I know that my devices are working because the code here: [u]http://www.instructables.com/id/RF-315433-MHz-Transmitter-receiver-Module-and-Ardu/step4/One-Transmitter-Multi-Receiver[/u]/ works, but the many other codes I have tried including this one give no result.
At this point, I have no clue what is happening, except that I might be getting interference, but wouldn't that just give me false readings instead of nothing at all?
I am in desperate need of help.