#include <VirtualWire.h>
      
      char *controller;
      void setup() {
         pinMode(13,OUTPUT);
         vw_set_ptt_inverted(true);
         vw_set_tx_pin(12);
         vw_setup(4000);// speed of data transfer Kbps
      }
      void loop() {
         controller="1" ;
         vw_send((uint8_t *)controller, strlen(controller));
         vw_wait_tx(); // Wait until the whole message is gone
         digitalWrite(13,1);
         delay(2000);
         controller="0" ;
         vw_send((uint8_t *)controller, strlen(controller));
         vw_wait_tx(); // Wait until the whole message is gone
         digitalWrite(13,0);
         delay(2000);
      }
      
      Cpp language logo

      Arduino - Wireless Communication(Transmitter)

      uno
      arduino

      The wireless transmitter and receiver modules work at 315 Mhz. They can easily fit into a breadboard and work well with microcontrollers to create a very simple wireless data link. With one pair of transmitter and receiver, the modules will only work communicating data one-way, however, you would need two pairs (of different frequencies) to act as a transmitter/receiver pair.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.