Arduino wireless communication(Reciever)

    0

    0

    Sohail Gulam

    unoarduino

    he 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.

    #include <VirtualWire.h>
    
    void setup() {
       vw_set_ptt_inverted(true); // Required for DR3100
       vw_set_rx_pin(12);
       vw_setup(4000); // Bits per sec
       pinMode(5, OUTPUT);
       vw_rx_start(); // Start the receiver PLL running
    }
    void loop() {
       uint8_t buf[VW_MAX_MESSAGE_LEN];
       uint8_t buflen = VW_MAX_MESSAGE_LEN;
       if (vw_get_message(buf, &buflen)) // Non-blocking {
          if(buf[0]=='1') {
             digitalWrite(5,1);
          }
          if(buf[0]=='0') {
             digitalWrite(5,0);
          }
       }
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.