// setup the output pins and the RF link void setup() { // initialize the LED 1 pins pinMode(LED1_RED, OUTPUT); pinMode(LED1_GREEN, OUTPUT); pinMode(LED1_BLUE, OUTPUT); // initialize the LED 2 pins pinMode(LED2_RED, OUTPUT); pinMode(LED2_GREEN, OUTPUT); pinMode(LED2_BLUE, OUTPUT); _selfTest(); // Start serial communication for debug output Serial.begin(9600); Serial.println("XFVWLamp ready"); // Initialize and start VirtualWire vw_set_rx_pin(RX_PIN); // Set the receive pin to RX_PIN vw_set_tx_pin(TX_PIN); vw_set_ptt_pin(PTT_PIN); vw_setup(2000); // Bits per sec vw_rx_start(); // Start the receiver PLL running }
void setup() { pinMode( TX_PIN, OUTPUT ); vw_set_tx_pin(TX_PIN); vw_setup(8000); // Bits per sec (half this though as running at 8mhz) pinMode( STATUS_LED, OUTPUT ); pinMode( IR_LED, OUTPUT ); digitalWrite( STATUS_LED, LOW ); }
///////////////////////////////////// // // Initialize the radio interface // void init_radio(void) { vw_set_ptt_pin(10); // defaults to 10 vw_set_rx_pin(11); // defaults to 11 vw_set_tx_pin(12); // defaults to 12 vw_setup(2000); // set up for 2000 bps vw_rx_start(); // start the rx radio_go = 1; // mark the rf system "up" }
// initialize library and set device uid int radio_init(radio_uid uid, uint16_t speed, uint8_t tx_pin, uint8_t rx_pin, uint8_t enable_receiver) { // Serial.print("init"); state.uid = uid; vw_set_tx_pin(tx_pin); vw_set_rx_pin(rx_pin); vw_setup(speed); if( enable_receiver ){ vw_rx_start(); } }
void CommClass::init() { #ifdef USE_433MHZ #ifdef WIRELESS_TRANSFER vw_set_ptt_inverted(true); vw_set_tx_pin(WIRELESS_433MHZ_TRANSFER_PIN); vw_setup(WIRELESS_SPEED);// speed of data transfer bits per second #endif #ifdef WIRELESS_RECEIVE vw_set_ptt_inverted(true); vw_set_rx_pin(WIRELESS_433MHZ_RECEIVE_PIN); vw_setup(WIRELESS_SPEED); // Bits per sec vw_rx_start(); // Start the receiver PLL running latestDataType = TYPE_NONE; #endif #endif //USE_433MHZ #ifdef USE_NRF24L rf24_module.begin(); rf24_module.setAutoAck(1); // Ensure autoACK is enabled rf24_module.enableAckPayload(); // Allow optional ack payloads rf24_module.setRetries(0, 10); // Smallest time between retries, max no. of retries rf24_module.setPayloadSize(MAX_PAYLOAD); // Here we are sending 1-byte payloads to test the call-response speed rf24_module.setDataRate(RF24_1MBPS); #ifdef WIRELESS_TRANSFER rf24_module.openWritingPipe((uint8_t*)WIRELESS_QUAD_ADDR); rf24_module.openReadingPipe(1, (uint8_t*)WIRELESS_QUAD_CTRL); #endif #ifdef WIRELESS_RECEIVE rf24_module.openWritingPipe((uint8_t*)WIRELESS_QUAD_CTRL); rf24_module.openReadingPipe(1, (uint8_t*)WIRELESS_QUAD_ADDR); #endif rf24_module.startListening(); // Start listening rf24_module.powerUp(); rf24_module.printDetails(); // Dump the configuration of the rf unit for debugging #endif //USE_NRF24L #ifdef USE_APC_220 //apc220.begin(WIRELESS_SPEED); #endif //USE_APC_220 }
/* Initialise as a transmitter. Must be done in the setup() method */ void RFEasy::init_transmitter(int pin) { _init(); //Initialization common to both transmitter and listener vw_set_tx_pin(pin); // Set listen pin in VirtualWire _type = transmitter_type; // Set the type to transmitter }
void SetupRFDataTxnLink(int transmit_pin, int baudRate) { vw_set_tx_pin(transmit_pin); vw_setup(baudRate); }
//------------------------------------End of Watchdog---------------------------------------------// //Setup// void setup () { vw_setup(2000); // Radio Baud Rate// vw_set_tx_pin(RadioTXPin ); // Set DATA radio TX Pin// NOTE: MUST BE PWM PIN pinMode(DataRadioSwitch,OUTPUT); }