Skip to content

Commit

Permalink
Update rcGW.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
serenad3 committed Mar 16, 2015
1 parent b4fc8c0 commit 83bf405
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions rcGW.ino
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
#include <SPI.h>
#include <Ethernet.h>
#include <stdlib.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>

char c;
char command[16];
boolean incoming = 0;

RF24 radio(8,9);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
const uint64_t pipes = 0xE8E8F0F0E1LL;

byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDA, 0x02};
IPAddress ip(192,168,1,177);
EthernetServer server(80);

char c;
char command[16];
boolean incoming = 0;

void setup(){

Serial.begin(9600);
Ethernet.begin(mac, ip);
server.begin();
radio.begin();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
// For debug
Serial.begin(9600);

radio.openWritingPipe(pipes);
}

void loop(){
Expand All @@ -39,17 +35,12 @@ void loop(){
if (c == '$') incoming = 1;
if (incoming == 1){

// Get the commands:
for (int x=0 ; x<16 ; x++){
c = client.read();
command[x] = c;
radio.write( &c, sizeof(unsigned long) );
// For debug
Serial.print(c);


radio.write(command, 16);

// Send DATA to nrf24l01+ destination
Serial.print(command);

}
incoming = 0;
Expand All @@ -60,5 +51,8 @@ void loop(){

delay(1);
client.stop();
radio.powerDown();
delay(1000);
radio.powerUp();

}

0 comments on commit 83bf405

Please sign in to comment.