Arduino - Wireless Communication(Transmitter)

    0

    0

    Sohail Gulam

    unoarduino

    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.

    #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);
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.