Update files
This commit is contained in:
1 parent
6706350811
commit
81fa7f1429
5 files changed
+291
-65
No files matched your search
@@ -21,9 +21,10 @@ void NrfInit()
|
||||
radio.setPALevel(RF24_PA_LOW);
|
||||
}
|
||||
|
||||
dataStruct2 NrfSendData(dataStruct2 data, bool debug = false)
|
||||
bool NrfSendData(dataStruct2 data, bool debug = false)
|
||||
//dataStruct2 NrfSendData(dataStruct2 data, bool debug = false)
|
||||
{
|
||||
network.update();
|
||||
// network.update();
|
||||
|
||||
if (debug)
|
||||
Serial.print("Sending...");
|
||||
@@ -39,5 +40,25 @@ dataStruct2 NrfSendData(dataStruct2 data, bool debug = false)
|
||||
Serial.println("failed.");
|
||||
}
|
||||
|
||||
return ok;
|
||||
// return data;
|
||||
}
|
||||
|
||||
dataStruct2 NrfGetData(dataStruct2 data, bool debug = false)
|
||||
{
|
||||
// network.update();
|
||||
int timeout = millis() + 100;
|
||||
while ( network.available() && timeout > millis() )
|
||||
{
|
||||
RF24NetworkHeader header;
|
||||
network.read(header, &data, sizeof(data));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Serial.print("Received packet ");
|
||||
Serial.println(data.servoPositions[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
Reference in new issue
Block a user