]> git.piffa.net Git - sketchbook_andrea/blob - hardware/rf315_433/trasmitter/trasmitter.ino
RF e keypad
[sketchbook_andrea] / hardware / rf315_433 / trasmitter / trasmitter.ino
1
2
3 //simple Tx on pin D12
4 //Written By : Mohannad Rawashdeh
5 // 3:00pm , 13/6/2013
6 // http://www.instructables.com/id/RF-315433-MHz-Transmitter-receiver-Module-and-Ardu/step3/Arduino-Virtual-Wire-Library/
7 // VirtualWire.h :   wiring.h  ->    Arduino.h
8 // VirtualWire.cpp : WProgram.h -> Arduino.h
9
10 //..................................
11 #include <VirtualWire.h>
12 char *controller;
13 void setup() {
14   pinMode(13,OUTPUT);
15   vw_set_ptt_inverted(true); //
16   vw_set_tx_pin(12);
17   vw_setup(4000);// speed of data transfer Kbps
18 }
19
20 void loop(){
21   controller="1"  ;
22   vw_send((uint8_t *)controller, strlen(controller));
23   vw_wait_tx(); // Wait until the whole message is gone
24   digitalWrite(13,1);
25   delay(2000);
26   controller="0"  ;
27   vw_send((uint8_t *)controller, strlen(controller));
28   vw_wait_tx(); // Wait until the whole message is gone
29   digitalWrite(13,0);
30   delay(2000);
31
32 }
33
34
35