I am currently designing a wireless controller that displays the VESC data (voltage, current, speed, etc.). I am using 2 arduinos that are connected to 2 NRF24L01 transceivers. The sending arduino is located on the skateboard and sends the telemetry data from the VESC to the receiving arduino. I am having trouble coding the transmitter side of the project as I do not know how to send the multiple variables to the receiving arduino. I am unfamiliar with this library for the NRF24L01 transceivers. Here is the code I have so far for the transmitting arduino.
#include <SPI.h>
#include "RF24.h"
#include <VescUart.h>
RF24 myRadio (7, 8); //Radio Setup
byte addresses[][6] = {"0"};
struct package
{
int id=1;
};
typedef struct package Package;
Package data;
VescUart UART; //Enables UART communication
void setup() {
Serial.begin(115200);//Radio Setup (again)
delay(1000);
myRadio.begin();
myRadio.setChannel(115);
myRadio.setPALevel(RF24_PA_MAX);
myRadio.setDataRate( RF24_250KBPS ) ;
myRadio.openWritingPipe( addresses[0]);
delay(1000);
Serial1.begin(19200);//UART Communication Setup
while (!Serial) {;}
UART.setSerialPort(&Serial1);
}
void loop() {
if ( UART.getVescValues() ) {//If Arduino recieves VESC Values then send data to recieving module.
myRadio.write(&data, sizeof(data));
Serial.print("\nPackage:");
Serial.print(data.id);
Serial.print("\n");
data.id = (UART.data.rpm)(UART.data.inpVoltage)(UART.data.ampHours)(UART.data.tachometerAbs);
}
}
I am aware that the code does not work, but much help is greatly appreciated :)
VESC WAND is doing that already.
http://www.trampaboards.com/trampas-amazing-vesc-wand-remote-control-is-...