commit 031833ca9f4d05a6d47673c9380fc9673d69656b Author: Adam Dodman Date: Fri Jan 26 02:35:02 2018 +0000 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c69f4c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.pioenvs +.piolibdeps diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bd5fea4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "lib/RF24"] + path = lib/RF24 + url = git@github.com:nRF24/RF24.git +[submodule "lib/RF24Network"] + path = lib/RF24Network + url = git@github.com:nRF24/RF24Network.git +[submodule "lib/RF24Mesh"] + path = lib/RF24Mesh + url = git@github.com:nRF24/RF24Mesh.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..71e9e6e --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# Uncomment lines below if you have problems with $PATH +#SHELL := /bin/bash +#PATH := /usr/local/bin:$(PATH) + +all: + platformio -f -c vim run + +upload: + platformio -f -c vim run --target upload + +clean: + platformio -f -c vim run --target clean + +program: + platformio -f -c vim run --target program + +uploadfs: + platformio -f -c vim run --target uploadfs + +update: + platformio -f -c vim update diff --git a/lib/RF24 b/lib/RF24 new file mode 160000 index 0000000..4accec5 --- /dev/null +++ b/lib/RF24 @@ -0,0 +1 @@ +Subproject commit 4accec5883bb3e65b3370b2e64627a787a790dc3 diff --git a/lib/RF24Mesh b/lib/RF24Mesh new file mode 160000 index 0000000..a832458 --- /dev/null +++ b/lib/RF24Mesh @@ -0,0 +1 @@ +Subproject commit a832458dbd066c7b8073a46f124ddec0fc9a9491 diff --git a/lib/RF24Network b/lib/RF24Network new file mode 160000 index 0000000..2292755 --- /dev/null +++ b/lib/RF24Network @@ -0,0 +1 @@ +Subproject commit 2292755ecb3f7912cf69bae7618c48f34ea612fe diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..597b511 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,16 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; http://docs.platformio.org/page/projectconf.html + +[env:esp12e] +platform = espressif8266 +board = esp12e +framework = arduino +upload_port = /dev/ttyACM* +upload_speed = 460800 diff --git a/src/main.ino b/src/main.ino new file mode 100644 index 0000000..5eb0280 --- /dev/null +++ b/src/main.ino @@ -0,0 +1,114 @@ + /** RF24Mesh_Example_Master.ino by TMRh20 + * + * + * This example sketch shows how to manually configure a node via RF24Mesh as a master node, which + * will receive all data from sensor nodes. + * + * The nodes can change physical or logical position in the network, and reconnect through different + * routing nodes as required. The master node manages the address assignments for the individual nodes + * in a manner similar to DHCP. + * + */ + + +#include +#include +#include + +#include "RF24Network.h" +#include "RF24.h" +#include "RF24Mesh.h" +#include +//Include eeprom.h for AVR (Uno, Nano) etc. except ATTiny +#include + +const char* ssid = "XXXX"; +const char* password = "XXXX"; + +/***** Configure the chosen CE,CS pins *****/ +RF24 radio(4,5); +RF24Network network(radio); +RF24Mesh mesh(radio,network); + +ESP8266WebServer http(80); + +uint32_t displayTimer = 0; + +String webpage = ""; + + +void setup() { + Serial.begin(115200); + + // Set the nodeID to 0 for the master node + mesh.setNodeID(0); + Serial.println(mesh.getNodeID()); + Serial.println("Starting...... "); + // Connect to the mesh + mesh.begin(); + + WiFi.begin(ssid, password); + + // Wait for connection + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + Serial.println(WiFi.status()); + } + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + + // Setup the web server + http.on("/", [](){ + webpage = "

Connected Clients:


"; + for(int i=0; i 5000){ + displayTimer = millis(); + Serial.println(" "); + Serial.println(F("********Assigned Addresses********")); + for(int i=0; i