Sei sulla pagina 1di 2

/*

1 transmitter
****************************
. http://www.youtube.com/user/d36073?feature=watch
v.02 NRF24L01 if Arduino 1 button press-Arduino 2 LED on
Version 0.2 2013/07/15
----------------------------;
Arduino 1 , ,
Arduino 2 () ,
----------------------------;
1. 1.5 ,
Arduino 1
Arduino 2 .
2. , ,
- .
-----------------------------
https://www.youtube.com/watch?v=iJJVj9kgS-A
--------------- 2
v.02 receiver NRF24L01 if Arduino 1 button press-Arduino 2 LED on
1
v.02 transmitter NRF24L01 if Arduino 1 button press-Arduino 2 LED on
-----------v.01 NRF24L01 if Arduino 1 button press-Arduino 2 LED on
https://www.youtube.com/watch?v=aJVSrGwZs2s
Arduino1 NRF24L01 Serial send. - Arduino2 led. LOW HIGH
https://www.youtube.com/watch?v=aHgxXXRwtOE&noredirect=1
Arduino nRF24L01 -2.4GHz RF24 Libraries. test
https://www.youtube.com/watch?v=B6LHfwisgUQ
NRF24L01+ 2.4GHz Antenna Wireless Transceiver Module For Microcontr
*/
// RF 24
//https://github.com/maniacbug/RF24
//https://github.com/maniacbug/RF24/archive/master.zip
//http://yadi.sk/d/ZvMq19fB6lgPs
#include <SPI.h>
#include "RF24.h"
int msg[1];
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
// NRF24L01 -> Arduino
//SCK -> 13
//MISO -> 12
//MOSI -> 11

//CSN -> 10
//CE -> 9
RF24 radio(9,10);
//
const uint64_t pipes[2] = {
0xF0F0F0F000LL, 0xF0F0F0F0FFLL};
//
int forward = 2;
int reverse = 3;
int forward = 4;
int reverse = 5;
void setup(void){
radio.begin();
radio.setDataRate(RF24_250KBPS); //
radio.setChannel(100); // 0 127
radio.setRetries(15,15); // -
radio.openWritingPipe(pipes[1]); //
radio.openReadingPipe(1, pipes[0]); // 6-
radio.startListening(); //
}
void loop(void){
// (buttonPin1) (111) Arduino 2
if (digitalRead(forward) == HIGH){
msg[0] = 111;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
if (digitalRead(reverse) == HIGH){
msg[0] = 112;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
if (digitalRead(forward1) == HIGH){
msg[0] = 113;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
if (digitalRead(reverse1) == HIGH){
msg[0] = 114;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
}

Potrebbero piacerti anche