How to the access back light of the RVR

I would like to access the back light of the RVR like we do with the SDK Arduino code for the two front light… so far no success

1 Like

Hello @rch_amp!

What platform are you using?

Are you trying to use the Arduino SDK to control the back light of RVR?

Thank you!

Quentin

1 Like

Yes and by the way are you planning to release for other Arduino processor like
The Mega 2560 , it has a lot more memory to program serious program …

Thank you for answering

Robert

Envoyé de mon iPad

1 Like

Hello Quentin,

I am actually working on Arduino and there is three thing I would like to be able to do

Retrieved X Y position , retrieved battery level in % and control the long back light of the river. If you could send me an exemple of how to used them in Arduino, it would be nice since I did nor succeed…

Thank you Robert

Envoyé de mon iPad

1 Like

Hi @rch_amp,

I just did some digging in the Arduino code. If you look at the Github repo and you download and extract the .zip file, you will be able to see an example (LEDcolor) that sets up a couple call back functions.

As far as what data is available, you should be able to get the battery level, and control the back LED by setting the proper bit mask (first parameter) in the following function:
rvr.changeLEDUint32(0x00000007, 0xFF, 0x00, 0x00);

I don’t know if the sensor streaming is implemented in this SDK, so you might need to work out the details for that!

I know this is a lot to process, but I hope this is enough information to get you started!

Quentin

1 Like

Hello Quentin,

This was good for the LED but I still have no success to retrieve the percentage of the battery , actually the program compile whiteout erreur but when I print the value , it is zero, there is no transfer between the RVR and the Arduino UNO . I have not find the way to retrieve info from the data structure in the SDK . I attached my experimental program so maybe you could tel me where I am wrong?

(Attachment get_battery_state_v2.ino is missing)

1 Like

Hello @rch_amp,

Glad you were able to make progress with this.
Did you try the example provided in the SDK to retrieve the battery level?

Also, I couldn’t see the attached file you posted.

Quentin

1 Like

The exemple is not giving any value back to the UNO
And I want to get the value from percentage

Envoyé de mon iPad

1 Like

Hello Quentin,

The program do not send any value like the percentage so I do not know how to capture value that we see

In the SDK files. Here is my testing program, it compile good but only the main loop is printing value…

If you could show me how to retrieve a value i should be good … so here is what i build from data and exemple

In the SDK Arduino

#include <SpheroRVR.h>

#include <SoftwareSerial.h>

#define rxPin 2

#define txPin 3

static void getBatteryPercentageCallback(GetBatteryPercentageReturn_t *batteryPercentageReturn);

static void GetMotorThermalProtectionStatusCallback(GetMotorThermalProtectionStatusReturn_t * MotorThermalProtectionReturn);

static void GetAmbientLightSensorValueCallback(GetAmbientLightSensorValueReturn_t *getAmbientLightSensorReturn);

uint8_t percentage = 0;

float leftMotorTemperature = 0;

float rightMotorTemperature = 0;

float AmbientLightSensor = 0;

uint8_t leftTermalStatus = 0;

uint8_t rightTermalStatus = 0;

int a = 0;

/*

Le circuit:

  • RX est la broche digital pin 2 (branche a TX du Arduino COM)

  • TX est la broche digital pin 3 (branche a RX au Arduino COM)

*/

SoftwareSerial Mega = SoftwareSerial(rxPin, txPin); // RX, TX dedie a la communication Arduino

void setup() {

// set up communication with the RVR

rvr.configUART(&Serial);

// give RVR time to wake up

delay(2000);

Mega.begin(9600);

delay(2000);

// get the battery voltage state

rvr.getBatteryPercentage(getBatteryPercentageCallback);

rvr.getMotorThermalProtectionStatus(GetMotorThermalProtectionStatusCallback);

rvr.getAmbientLightSensorValue(GetAmbientLightSensorValueCallback);

Mega.println(“Fin de l’initialisation”);

delay (2000);

Mega.println(“Debut de la boucle…”);

}

void loop() {

// must include this line if expecting a response from the RVR

rvr.poll();

a = a + 1;

Mega.println(leftMotorTemperature);

Mega.println(leftTermalStatus);

Mega.println(rightMotorTemperature);

Mega.println(rightTermalStatus);

Mega.println(percentage);

Mega.println(AmbientLightSensor);

delay(1000);

Mega.println(a);

}

static void getBatteryPercentageCallback(GetBatteryPercentageReturn_t *batteryPercentageReturn)

{

// put your code here to run when you get the battery voltage state

if(GetBatteryPercentageReturn->percentage > 0 )

Mega.println(“pourcentage”);

pourcentage = percentage;

Mega.print(pourcentage);

            Mega.println("%");

}

static void GetMotorThermalProtectionStatusCallback(GetMotorThermalProtectionStatusReturn_t *MotorThermalProtectionReturn)

{

if(MotorThermalProtectionReturn->leftMotorTemperature > 0 )

Mega.print("Temperature gauche : ");

            Mega.println(leftMotorTemperature);

Mega.print("Etat gauche : ");

            Mega.println(leftMotorStatus);

Mega.print("Temperature droite : ");

            Mega.println(rightMotorTemperature);

Mega.print("Etat droit : ");

            Mega.println(rightMotorStatus);

}

static void GetAmbientLightSensorValueCallback(GetAmbientLightSensorValueReturn_t *getAmbientLightSensorReturn)

{

if(getAmbientLightSensorReturn->ambientLightValue > 0 )

Mega.print("Eclairage ambient : ");

Mega.println(ambientLightValue);

}

So let me know what I am doing wrong???

Thank you

Robert

1 Like