1// transmitter.pde
2//
3// Simple example of how to use VirtualWire to transmit messages
4// Implements a simplex (one-way) transmitter with an TX-C1 module
5//
6// See VirtualWire.h for detailed API docs
7// Author: Mike McCauley (mikem@open.com.au)
8// Copyright (C) 2008 Mike McCauley
9// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
1011
#include <VirtualWire.h>
12#undef int
13#undef abs
14#undef double
15#undef float
16#undef round
17void setup()
18{
19Serial.begin(9600); // Debugging only
20Serial.println("setup");
2122
// Initialise the IO and ISR
23vw_set_ptt_inverted(true); // Required for DR3100
24vw_setup(2000); // Bits per sec
25}
2627
void loop()
28{
29const char *msg = "hello";
3031
digitalWrite(13, true); // Flash a light to show transmitting
32vw_send((uint8_t *)msg, strlen(msg));
33vw_wait_tx(); // Wait until the whole message is gone
34digitalWrite(13, false);
35delay(200);
36}