Update RC_Excavator_TX.ino, configuration_input.h, functions.h, and 1 more file
This commit is contained in:
+7
-4
@@ -20,7 +20,7 @@ By: mxcory
|
||||
//Initiate transceiver object
|
||||
RF24 radio(CE_PIN, CSN_PIN);
|
||||
|
||||
uint8_t address[][6] = { "1Node", "2Node" };
|
||||
uint8_t address[][6] = { "RXDev", "TXDev" };
|
||||
|
||||
PayloadStruct payload;
|
||||
|
||||
@@ -31,6 +31,9 @@ PayloadStruct payload;
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(A1, INPUT);
|
||||
|
||||
if (!radio.begin()) {
|
||||
Serial.println("Radio not respodind...");
|
||||
while (1) {} //Hold loop for radio failure
|
||||
@@ -43,9 +46,9 @@ void setup() {
|
||||
|
||||
radio.enableAckPayload();
|
||||
|
||||
radio.openWritingPipe(address[0]);
|
||||
radio.openWritingPipe(address[1]);
|
||||
|
||||
radio.openReadingPipe(1, address[1]);
|
||||
radio.openReadingPipe(1, address[0]);
|
||||
|
||||
memcpy(payload.message, "Hello", 6); //Set Payload Message
|
||||
radio.stopListening(); //Put radio in TX mode
|
||||
@@ -89,5 +92,5 @@ void loop() {
|
||||
#endif
|
||||
|
||||
setMessage(); //Prepare value that will be sent
|
||||
delay(25);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
//Number of channels
|
||||
#define NUM_CHANNELS 9
|
||||
#define NUM_CHANNELS 10
|
||||
|
||||
|
||||
//Byte array for inputs
|
||||
byte TX_CHANNELS[ NUM_CHANNELS ][ 10 ] = {0};
|
||||
byte TX_CHANNELS[ NUM_CHANNELS+1 ][ 10 ] = {0};
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-2
@@ -6,15 +6,22 @@ bool setMessage() {
|
||||
int _length = NUM_CHANNELS + 1; //Number of channels plus reserved positions
|
||||
char _SEND_MESSAGE [ _length ];
|
||||
|
||||
_SEND_MESSAGE[0] = 100; //Place Device ID into first position
|
||||
_SEND_MESSAGE[0] = -128; //Place Device ID into first position
|
||||
//_SEND_MESSAGE[1] = 200; //Place Target ID into second position
|
||||
//_SEND_MESSAGE[2] = 5; //Place enable flag in third position
|
||||
|
||||
TX_CHANNELS[1][_VAL] = map(analogRead(A0), 0, 255, -128, 128);
|
||||
TX_CHANNELS[2][_VAL] = map(analogRead(1), 0, 255, -128, 128);
|
||||
|
||||
Serial.println(map(analogRead(A1), 0, 1024, -128, 128));
|
||||
|
||||
for ( int i=1; i<_length; i++) { //Place channel values srarting at pos 2
|
||||
_SEND_MESSAGE[i] = TX_CHANNELS[i][_VAL] + _mod;
|
||||
}
|
||||
_mod++;
|
||||
//_mod++;
|
||||
|
||||
|
||||
|
||||
|
||||
memcpy(payload.message, _SEND_MESSAGE, 24); //Copy message into payload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user