{"id":20989162,"url":"https://github.com/latchdevel/virtualwire","last_synced_at":"2025-05-14T18:31:43.479Z","repository":{"id":145788579,"uuid":"254752436","full_name":"latchdevel/VirtualWire","owner":"latchdevel","description":"A github'ified version of VirtualWire Arduino library v1.27 (2014)","archived":false,"fork":false,"pushed_at":"2024-04-10T15:59:44.000Z","size":1371,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-10T18:21:40.639Z","etag":null,"topics":["315mhz","433mhz","am","arduino","ask","ook","radio","radiohead","virtualwire","wireless"],"latest_commit_sha":null,"homepage":"https://latchdevel.github.io/VirtualWire/","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/latchdevel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-04-10T22:58:58.000Z","updated_at":"2024-04-10T16:00:51.000Z","dependencies_parsed_at":"2023-04-13T09:48:07.602Z","dependency_job_id":null,"html_url":"https://github.com/latchdevel/VirtualWire","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FVirtualWire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FVirtualWire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FVirtualWire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FVirtualWire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/latchdevel","download_url":"https://codeload.github.com/latchdevel/VirtualWire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225304955,"owners_count":17453249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["315mhz","433mhz","am","arduino","ask","ook","radio","radiohead","virtualwire","wireless"],"created_at":"2024-11-19T06:24:00.240Z","updated_at":"2024-11-19T06:24:00.323Z","avatar_url":"https://github.com/latchdevel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virtual Wire\nThis is the VirtualWire \"pure C\" library for Arduino and other boards.\nIt provides a simple message passing protocol for a range of inexpensive transmitter and receiver modules.\n\n## END OF LIFE NOTICE (2014)\nThis VirtualWire library has now been superceded by the RadioHead  library http://www.airspayce.com/mikem/arduino/RadioHead\nRadioHead and its RH_ASK driver provides all the features supported by VirtualWire, and much more\nbesides, including Reliable Datagrams, Addressing, Routing and Meshes.\nRH_ASK driver message format and software technology is based on VirtualWire library, with which it is compatible.\nAll the platforms that VirtualWire supported are also supported by RadioHead. \n\nThis library will no longer be maintained or updated, but we will continue to publish\nit for the benefit of the the community. Nevertheless we recommend upgrading to RadioHead where\npossible.\n\n### Installation\nTo install, unzip the library into the libraries sub-directory of your Arduino application directory. \nThen launch the Arduino environment; you should see the library in the Sketch-\u003eImport Library menu, and example code in\nFile-\u003eSketchbook-\u003eExamples-\u003eVirtualWire menu.\n\nTo use the VirtualWire library, you must have:\n```c\n#include \u003cVirtualWire.h\u003e\n```\nat the top of your sketch.\n\n## VirtualWire API\n\nVirtualWire is a library for Arduino, Maple and others that provides features to send short messages, without addressing, retransmit or acknowledgment, a bit like UDP over wireless, using ASK (amplitude shift keying). \nSupports a number of inexpensive radio transmitters and receivers. All that is required is transmit data, receive data and (for transmitters, optionally) a PTT transmitter enable. \nCan also be used over various analog connections (not just a data radio), such as the audio channel of an A/V sender It is intended to be compatible with the RF Monolithics (www.rfm.com) Virtual Wire protocol, but this has not been tested.\n\nDoes not use the Arduino UART. Messages are sent with a training preamble, message length and checksum. Messages are sent with 4-to-6 bit encoding for good DC balance, and a CRC checksum for message integrity.\n\nBut why not just use a UART connected directly to the transmitter/receiver? As discussed in the RFM documentation, ASK receivers require a burst of training pulses to synchronize the transmitter and receiver, and also requires good balance between 0s and 1s in the message stream in order to maintain the DC balance of the message. \nUARTs do not provide these. They work a bit with ASK wireless, but not as well as this code.\n\n### Implementation Details\nMessages of up 67 bytes can be sent each message is transmitted as:\n\n- 36 bit training preamble consisting of 0-1 bit pairs\n- 12 bit start symbol 0xb38\n- 1 byte of message length byte count (4 to 30), count includes byte count and FCS bytes\n- n message bytes (uincluding 4 bytes of header), maximum n is MAX_MESSAGE_LEN + 4 (64)\n- 2 bytes FCS, sent low byte-hi byte\n\nThe Arduino UNO clock rate is 16MHz =\u003e 62.5ns/cycle. For an RF bit rate of 2000 bps, need 500microsec bit period. \nThe ramp requires 8 samples per bit period, so need 62.5microsec per sample =\u003e interrupt tick is 62.5microsec.\n\nThe maximum packet length consists of (6 + 2 + MAX_MESSAGE_LEN*2) * 6 = 768 bits = 0.384 secs (at 2000 bps). where MAX_MESSAGE_LEN is MAX_PAYLOAD_LEN - 7 (= 60). \nThe code consists of an ISR interrupt handler. Most of the work is done in the interrupt handler for both transmit and receive, but some is done from the user level. \nExpensive functions like CRC computations are always done in the user level.\n\n### Supported Hardware\nA range of communications hardware is supported. The ones listed below are available in common retail outlets in Australia and other countries for under $10 per unit.  Many other modules may also work with this software. \n\nRuns on a wide range of Arduino processors using Arduino IDE 1.0 or later.\nRuns on ATmega8/168 (Arduino Diecimila, Uno etc), ATmega328 and can run on almost any other AVR8 platform, without relying on the Arduino framework, by properly configuring the library using 'VirtualWire_Config.h' header file for describing the access to IO pins and for setting up the timer. From version 1.22 the library can be compiled by a C compiler (by renaming VirtualWire.cpp into VirtualWire.c) and can be easily integrated with other IDEs like 'Atme Studio' for example (courtesy of Alexandru Mircescu).\n\nAlso runs on on Energia with MSP430G2553 / G2452 and Arduino with ATMega328 (courtesy Yannick DEVOS - XV4Y),  but untested by us. It also runs on Teensy 3.0 and 3.1 (courtesy of Paul Stoffregen) using the Arduino IDE 1.0.5 and the Teensyduino addon 1.18. \nAlso compiles and runs on ATtiny85 in Arduino environment, courtesy r4z0r7o3. \nAlso compiles on maple-ide-v0.0.12, and runs on Maple, flymaple 1.1 etc. \n\n- Receivers\n - RX-B1 (433.92MHz) (also known as ST-RX04-ASK)\n- Transmitters: \n - TX-C1 (433.92MHz)\n- Transceivers\n - DR3100 (433.92MHz)\n\nFor testing purposes you can connect 2 VirtualWire instances directly, by connecting pin 12 of one to 11 of the other and vice versa, like this for a duplex connection:\n```\nArduino 1       wires          Arduino 2\n D11-----------------------------D12\n D12-----------------------------D11\n GND-----------------------------GND\n```\n\nYou can also connect 2 VirtualWire instances over a suitable analog transmitter/receiver, such as the audio channel of an A/V transmitter/receiver. \nYou may need buffers at each end of the connection to convert the 0-5V digital output to a suitable analog voltage.\n\n**Caution:*** ATTiny85 has only 2 timers, one (timer 0) usually used for millis() and one (timer 1) for PWM analog outputs. \nThe VirtualWire library, when built for ATTiny85, takes over timer 0, which prevents use of millis() etc but does permit analog outputs.\n\n## Basic Usage\nVirtualWire works somewhat differently than most Arduino libraries. Many individual functions are used, and their names are somewhat different. Fortunately, each one is simple.\n\n### Configuration Functions\n`vw_set_tx_pin(transmit_pin)`\nConfigure the transmit pin. Default is pin 12.\n\n`vw_set_rx_pin(receive_pin)`\nConfigure the receive pin, Default is pin 11. On Teensy 2.0, pin 11 should not be used because most receiver modules can not work correctly with the orange LED on that pin.\n\n`vw_set_ptt_pin(transmit_en_pin)`\nConfigure the transmit enable pin, or \"push to talk\". Default is pin 10.\n\n`vw_set_ptt_inverted(true)`\nConfigure the \"push to talk\" polarity.\n\n`vw_setup(2000)`\nBegin using all settings and initialize the library. This is similar to the \"begin\" function of other libraries. All pins should be configured before calling this function.\n\n### Transmission Functions\n`vw_send(message, length)`\nTransmit a message. \"message\" is an array of the bytes to send, and \"length\" is the number of bytes stored in the array. This function returns immediately and the message is sent slowly by an interrupt-based background process.\n\n`vw_tx_active()`\nReturns true if the message is being sent, or false if the transmitter is not active. You can use this after sending a message to test when it has finished being transmitted.\n\n`vw_wait_tx()`\nWait for a message to be fully transmitted. Often the simplest approach is to call this after vw_send.\n\n### Reception Functions\n`vw_rx_start()`\nActivate the receiver process. You must call this function before any reception can occur. An interrupt-based background process is started which monitors the reception of data.\n\n`vw_have_message()`\nReturns true if message has been received. This is similar to the \"available\" function of most other libraries.\n\n`vw_wait_rx()`\nWait for a message to be received. This will only return when a message has been received, otherwise it will wait forever.\n\n`vw_wait_rx_max(timeout_ms)`\nWait for a message, but give up after \"timeout_ms\". Returns true if a message was received, or false if the timeout period elapsed.\n\n`vw_get_message(buf, \u0026buflen))`\nRead the last received message. This should be called only when a message is known to be received with any of the 3 functions above. \"buf\" is an array where the message is copied. \"buflen\" should have the array's maximum size upon input, and upon return the number of bytes actually copied is retured. The function itself returns true if the message was verified correct, or false if a message was received but appears to have been corrupted.\n\n`vw_rx_stop()` \nDisable the receiver process.\n\n## Trademarks\n\nVirtualWire is a trademark of AirSpayce Pty Ltd. The VirtualWire mark was first used on April 20 2008 for\ninternational trade, and is used only in relation to data communications hardware and software and related services.\nIt is not to be confused with any other similar marks covering other goods and services.\n\n## Copyright\n\nThis software is Copyright (C) 2008-2014 Mike McCauley (mikem@airspayce.com).\nUse is subject to license conditions. The main licensing options available are GPL V2 or Commercial.\n\n### Open Source Licensing GPL V2\n\nThis is the appropriate option if you want to share the source code of your\napplication with everyone you distribute it to, and you also want to give them\nthe right to share who uses it. If you wish to use this software under Open\nSource Licensing, you must contribute all your source code to the open source\ncommunity in accordance with the GPL Version 2 when your application is\ndistributed. See http://www.gnu.org/copyleft/gpl.html\n\n### Commercial Licensing\n\nThis is the appropriate option if you are creating proprietary applications\nand you are not prepared to distribute and share the source code of your\napplication. Contact info@airspayce.com for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatchdevel%2Fvirtualwire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flatchdevel%2Fvirtualwire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatchdevel%2Fvirtualwire/lists"}