Repository navigation
1. Getting Started
Before start programming the rero in C language, please download a copy of the source code to your computer. Please also make sure that MPLAB X IDE and XC32 Compiler have been installed. After that, open the project with the MPLAB X IDE.
In most condition, only 2 files (UserProgram.c and UserProgram.h) need to be modified to run the custom user program on rero main controller. Just follow these simple steps to start programming the rero in C language.
-
Open the "UserProgram.h" and uncomment the line
#define RUN_USER_PROGRAM./************************************************************************** * PUBLIC CONSTANT DEFINITION **************************************************************************/ #define RUN_USER_PROGRAM -
After that, you may start writting your own program in the function
void taskUserProgram(void *pvParameters)in file "UserProgram.c"./************************************************************************** * TASK: taskBluetoothProgram * * DESCRIPTIONS: * Task for the bluetooth programming. * **************************************************************************/ void taskUserProgram(void *pvParameters) { // Set the G15 angle limit (0 - 1087). eG15SetAngleLimit(11, 0, 1087); // Turn on torque for G15. eG15SetTorqueLed(11, WRITE_NOW, 1, 1); // Loop forever. while (1) { // Read from IR sensor. unsigned char ucSensorValue; eInfraredSensorGetValue(101, &ucSensorValue); // Set the G15 position according to the sensor value. eG15SetPositionSpeed( 11, WRITE_NOW, ucSensorValue, NORMAL_POSITIONING, 0, POSITION_SPEED_CONTROL); // Delay for 50ms. vTaskDelay(50 / portTICK_RATE_MS); } } -
Compile the source code and upload the .hex file to the rero main controller using the rero Firmware Updater. The .hex file is located in folder ..\Rero Main Controller Firmware.X\dist\default\production.
-
Power up the main controller and wait until the main menu is loaded. Press the "C PROGRAM" button to enter the custom C program page.
-
Press the play button to run the user program. Press the stop button to stop it.