I have a 433MHz transmitter and a seperate receiver. Each is plugged into its own bread board and each has its own Uno. Each has its own power supply feeding the Unos (and thus the breadboards). Before hooking to their Unos, I have confirmed both the TX and RX modules are good (set them up manualy with no Unos involved, put the TX data in lead to Vcc and the LED on the RX module glows every time).
My transmit and receive sketches compile with no errors. receiver Uno does not show getting any messages from the transmiter... and no errors are given and nothing hangs. I am stumped at this point. Any help is much apreciated. Thank you !
transmitter
#include <crc16.h>
#include <VirtualWire.h>
// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
const int led_pin = 11;
const int transmit_pin = 12;
const int receive_pin = 2;
const int transmit_en_pin = 3;
void setup()
{
Serial.begin(9600); // Debugging only
// 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
pinMode(led_pin, OUTPUT);
}
byte count = 1;
void loop()
{
char msg[7] = {'h','e','l','l','o',' ','#'};
Serial.println("=========================================================");
Serial.print("Sending wireless message : ");
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(10);
count = count + 1;
Serial.println(" done ");
}
receiver
#include <crc16.h>
#include <VirtualWire.h>
// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
const int led_pin = 13;
const int transmit_pin = 12;
const int receive_pin = 9;
const int transmit_en_pin = 3;
void setup()
{
delay(1000);
Serial.begin(9600); // Debugging only
Serial.println("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
vw_rx_start(); // Start the receiver PLL running
pinMode(led_pin, OUTPUT);
}
void loop()
{
Serial.println(" looking for a message ");
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;
digitalWrite(led_pin, HIGH); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print(buf*, HEX);*
- Serial.print(' ');*
- }*
- Serial.println();*
- digitalWrite(led_pin, LOW);*
- }*
- delay(30);*
- return;*
- }*