I'm trying to write a function for nRF24L01 starting with
if (radio.available()){
doing the normal receiving data but in the new function i want to put a 2nd if
if radion not available to put the variables that are not received in a normal state, what I mean?
I receive data from a nRF from a pot and controlling the servo, I got a variable that are in between them and transmitting the value of the pot transforming it into the value of degrees for the servo, the main problem is If I don't receive any kind of data the servo goes crazy turning in a direction and making the gears going crazy and at some point maybe breaking them.
I want to write a function that will allow me to put a 90deg. state for the servo if there's no data received or no connection thru nRF.
How do I write if radion not available {
Do that.. ?
}
Edit: I know how to put the state of the servo, what I don't know is how to know if there is not connection thru nRF.
I think you have at least 2 other Threads about nRF24s - I don't want to waste time repeating advice I have already given. Why not keep everything in one Thread so we could all see the history?
I think you have at least 2 other Threads about nRF24s
That was like 20 topics ago looking my history, I took many of your advice about nRF and everything is working but a point that I never knew is how to see if the nRF is available/receiving or not data.
Domino60:
That was like 20 topics ago looking my history, I took many of your advice about nRF and everything is working but a point that I never knew is how to see if the nRF is available/receiving or not data.
I'm not going to waste my time giving advice that I may have given earlier when I have no easy way to look back and see what I said and whether it was relevant or whether it was just ignored.
I'm not going to waste my time giving advice that I may have given earlier when I have no easy way to look back and see what I said and whether it was relevant or whether it was just ignored.
But the fun fact is you waste your time commenting be back instead writing a little bit or code or at least a copy/paste or something
Ok ok I understand, i will not waste your time i will wait some answers from other people if they are happy to help me, if no one gonna give me something then probably gonna try to find something on my own or improvise something or .. who knows, i will see
So because my code is really big i will post only the parts of the code that I got problem
And I'm sending the values to the slave as you can see PotSpeed,PotY,PotX.
Now the problem is if I plug 1st my receiver circuit there is not incoming data from the transmiter and my servos are going crazy even if I put ..
if I plug 1st the transmiter and 2nd the receiver everything is working good, now the part that I want to fix is the part that my servos are going crazy because there is no data coming from the transmiter, I'm not sure why the PotSpeed,PotY and PotX are not taking the values 0,90,90.
Edit:
I want to make the code in that way, if there is no data or the transmitter is not online then the values gonna take what I give them and stay like that till the transmitter is back online.
Domino60:
But the fun fact is you waste your time commenting be back instead writing a little bit or code or at least a copy/paste or something
I'm sorry to spoil your illusion but giving useful advice here involves a great deal more than is implied by your words "writing a little bit of code". My strong suspicion is that I have already answered your question 2 or 3 times to no effect.
I'm sorry to spoil your illusion but giving useful advice here involves a great deal more than is implied by your words "writing a little bit of code". My strong suspicion is that I have already answered your question 2 or 3 times to no effect.
Robin not being offensive but what's the point typing here without useful comment telling that you waste your time reposting. What would you do if a new member came and had the same problem as me? Should I make a new account and ask the same problem? Then you maybe help?
As I said not being offensive but help instead of telling me that you waste your time, you waste your time and my time by commenting with that wasting time comments.
If you think that you waste time with me then don't... just don't comment, let other people help me.
btw about telling me that you may gave me that answer in the past, I'm not a database to remember everything.
comment #8 you guild me to follow your links and use your example and the TMRh20 version of the RF24 library as you say.
That days and this post i start learning about nRF24 and using only the RF24 Library and IDE 1.0.5 till today
I ended the topic by posting a totally successfull range test video.
I think you have at least 2 other Threads about nRF24s - I don't want to waste time repeating advice I have already given. Why not keep everything in one Thread so we could all see the history?
I don't remember and I don't see from the links giving me advice about "" if there's no data received or no connection thru nRF. How do I write if radion not available { Do that.. ? } ""
I don't remember / see giving me advice/tell me / code about how to see the state of the wireless connection if there is radio available or not.
I don't hate you and I don't want to be offensive but or you help or you don't comment, it's not something personal but at this point I start wasting my time. (I would better create a new account and get a answer from you faster than wasting time here).
Is the full program that causes the servo to "go crazy" in this thread somewhere ?
I get the values thru nRF of the pots after that send the values thru I2C to a 2nd chip that chip got a receiving function and a mapping function of each servo if there is no data thru nRF and getting value from pot the servos don't get any value so in this case im not sure what's causing my servos to run in a single direction, probably the mapping function.
Here is my Slave that get's data thru I2C and I map the servos
if(bCount == (sizeof PotSpeed) + (sizeof PotY) + (sizeof PotX)){What is it intended to do ?
The sizeof() function, when used properly, returns how many bytes of storage a variable takes. As an example PotSpeed is an int so will always use 2 bytes no matter what value it holds.
The sizeof() function, when used properly, returns how many bytes of storage a variable takes. As an example PotSpeed is an int so will always use 2 bytes no matter what value it holds.
There is this library
#include <I2C_Anything.h>
I found on forum from topics/google talking about I2C it's a easy library to transfer integers, floats, double thru I2C easy to use without any painful hard writing code I got many things on my I2C and I find easy for me to use this method there is more about it to tell but that's not the point of the topic here.
yea I know that a int will return 2 bytes no mater what, that's the case here how to put the PotSpeed or X,Y to get a value if there is no data received thru nRF.
If I don't have my nRF connected 1st my servos take random values