From ad92b01b3288f6b6f155497e5949fc3f32c92eba Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:26:34 -0300 Subject: [PATCH 1/9] create reciver.ino and wrote the basic structure --- reciver.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 reciver.ino diff --git a/reciver.ino b/reciver.ino new file mode 100644 index 0000000..58dac61 --- /dev/null +++ b/reciver.ino @@ -0,0 +1,10 @@ +#include + +void setup() +{ + +} +void loop() +{ + +} From 49ff6d11520c1e6953c8c2cd51ef79a81fcac2dc Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:33:45 -0300 Subject: [PATCH 2/9] fixing the file's name --- reciver.ino => receiver.ino | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename reciver.ino => receiver.ino (100%) diff --git a/reciver.ino b/receiver.ino similarity index 100% rename from reciver.ino rename to receiver.ino From c450cf7222a3aff107d30d72f66cf2ae75ea3577 Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:34:56 -0300 Subject: [PATCH 3/9] create the emitter.ino fle --- emitter.ino | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 emitter.ino diff --git a/emitter.ino b/emitter.ino new file mode 100644 index 0000000..525b19e --- /dev/null +++ b/emitter.ino @@ -0,0 +1,11 @@ +#include + +void setup() +{ + +} + +void loop() +{ + +} From 43debcfaf838335410a0408b43d00df97a70dfcf Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Wed, 26 Sep 2018 17:24:22 -0300 Subject: [PATCH 4/9] #2 sketch made --- receiver.ino | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/receiver.ino b/receiver.ino index 58dac61..8f3e9dd 100644 --- a/receiver.ino +++ b/receiver.ino @@ -1,10 +1,45 @@ +#include #include +#include -void setup() +Servo servox; +Servo servoy; + +RF24 radio (7, 8); + +struct package { + int valbx = 90; //thats will make the camera allways start in right position 90 degrees + int valby = 90; + +}data; + +byte addresses[][6] = {"0"}; + + +void setup() { + + radio.begin(); + radio.setChannel(115); + radio.setPALevel(RF24_PA_MAX); + radio.setDataRate( RF24_250KBPS ) ; + radio.readingPipe(1,addresses[0]); + radio.startListening(); + + servox.attach(9); + servoy.attach(10); } + void loop() { - + if(radio.available() + { + while(radio.available()) + { + radio.(&data,sizeof(data)); + servox.write(data.valbx); + servoy.write(data.valby); + } + } } From 99fff2d8e8ab23cabdb94a898000f140fdebe5bc Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Fri, 28 Sep 2018 16:13:04 -0300 Subject: [PATCH 5/9] update on line 22 --- receiver.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/receiver.ino b/receiver.ino index 8f3e9dd..5658140 100644 --- a/receiver.ino +++ b/receiver.ino @@ -18,8 +18,8 @@ byte addresses[][6] = {"0"}; -void setup() { - +void setup() +{ radio.begin(); radio.setChannel(115); radio.setPALevel(RF24_PA_MAX); From 2e350cacd8d41e4614238a120254ef16619ee986 Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 2 Oct 2018 17:12:32 -0300 Subject: [PATCH 6/9] #3 emitter base program, done. --- emitter.ino | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/emitter.ino b/emitter.ino index 525b19e..bc07b64 100644 --- a/emitter.ino +++ b/emitter.ino @@ -1,11 +1,39 @@ +#include #include +RF24 radio (7, 8); +struct package{ + + int valbx = 90; + int valby = 90; + +}data; + +byte addresses[][6] = {"0"}; + +int valx; +int valy; + void setup() { + radio.begin(); + radio.setChannel(115); + radio.setPALevel(RF24_PA_MAX); + radio.setDataRate( RF24_250KBPS ) ; + radio.openWritingPipe(addresses[0]); + } void loop() { + + valx = analogRead(0); + valy = analogRead(1); + + valx = map(valx,0,1023,0,179); + valy = map(valy,0,1023,0,179); + + radio.write(&data,sizeof(data)); } From 8ad8860cd8abb4f9f5b39da2f261a7776b07e63a Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 2 Oct 2018 17:19:07 -0300 Subject: [PATCH 7/9] adding comments to emitter.ino --- emitter.ino | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/emitter.ino b/emitter.ino index bc07b64..e8bb85f 100644 --- a/emitter.ino +++ b/emitter.ino @@ -2,38 +2,39 @@ #include RF24 radio (7, 8); -struct package{ +struct package //struct of data to be sent +{ int valbx = 90; int valby = 90; }data; -byte addresses[][6] = {"0"}; +byte addresses[][6] = {"0"}; //addresses -int valx; +int valx; //initializes values of horizontal and vertical servos int valy; void setup() { - - radio.begin(); + //radio setup + radio.begin(); radio.setChannel(115); radio.setPALevel(RF24_PA_MAX); radio.setDataRate( RF24_250KBPS ) ; radio.openWritingPipe(addresses[0]); - + //end of radio setup } void loop() { - valx = analogRead(0); - valy = analogRead(1); + valx = analogRead(0); //potentiometer attached to A0 pin + valy = analogRead(1); //potentiometer attached to A1 pin - valx = map(valx,0,1023,0,179); + valx = map(valx,0,1023,0,179); //mapping to the right values valy = map(valy,0,1023,0,179); - radio.write(&data,sizeof(data)); + radio.write(&data,sizeof(data)); //sending data } From f01090c9ba6715bb56112e9204090c10fde0ce3c Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 2 Oct 2018 17:26:19 -0300 Subject: [PATCH 8/9] adding feature which eliminate unnecessary work servo motors won't be receiving unnecessary data, it can provide more stability. --- receiver.ino | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/receiver.ino b/receiver.ino index 5658140..ff8cd0d 100644 --- a/receiver.ino +++ b/receiver.ino @@ -16,7 +16,7 @@ struct package byte addresses[][6] = {"0"}; - +int valx_before,valy_before; void setup() { @@ -38,8 +38,14 @@ void loop() while(radio.available()) { radio.(&data,sizeof(data)); - servox.write(data.valbx); - servoy.write(data.valby); + valx_before = data.valx; + valy_before = data.valy; + + if(data.valx != valx_before || data.valy != valy_before) + { + servox.write(data.valbx); + servoy.write(data.valby); + } } } } From 71cd5c94e2f7e4519ba1d364c3ef7b5beb663bf7 Mon Sep 17 00:00:00 2001 From: Arthur Cabral Fleischman <33187588+TkfleBR@users.noreply.github.com> Date: Tue, 2 Oct 2018 17:27:47 -0300 Subject: [PATCH 9/9] update comment on line 12 --- receiver.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver.ino b/receiver.ino index ff8cd0d..3cf0a9d 100644 --- a/receiver.ino +++ b/receiver.ino @@ -9,7 +9,7 @@ RF24 radio (7, 8); struct package { - int valbx = 90; //thats will make the camera allways start in right position 90 degrees + int valbx = 90; //that will make the camera allways start in right position, 90 degrees int valby = 90; }data;