Today we are releasing Totem framework - Arduino implementation for RoboBoard X4.
This integration lifts Totem programming to a whole new level by giving more features, much better coding experience and full integration with Arduino IDE. Now RoboBoard X4 can be installed trough Board Manager without any complicated setup.
All instructions can be found in http://docs.totemmaker.net website.
New features:
Available trough boards manager
Simple one click install.
(URL: https://totemmaker.github.io/TotemArduinoBoards/package_totemmaker_index.json
)
RoboBoard X4 menu
You can find X4 in Boards list. Also, menu contains only required fields.
“Burn Bootloader” feature allows to upgrade internal X4 driver to utilize new functionality.
App connectivity setting
Easily select if connectivity with Totem app is required.
New objective code API
Code to control X4 and modules became more advanced and easier to use. With a few simple instructions you can control all the functionality. It also plays nice with code autocomplete.
Module11 dist_sensor;
void setup() {
}
void loop() {
X4.rgb.colorTotem(); // Set RGB to Totem colors
delay(1000);
X4.rgb.color(0, 255, 0); // Set RGB to green color
delay(1000);
X4.dcA.power(100); // Start spin DC A motor
delay(1000);
X4.servoB.angle(90); // Move servo B to 90 degrees
delay(1000);
if (dist_sensor.distance.getCm() < 10) // Get distance from module 11
X4.dcA.brake(); // Brake DC A motor
delay(1000);
Control program from Totem App
Receive event when button inside Totem App is clicked, to perform any action
void eventFunctionA() {
X4.dcA.power(X4.functionA.get());
}
void eventFunctionB() {
X4.servoA.pos(X4.functionB.get());
}
void eventFunctionC() {
X4.rgb.color(0, X4.functionC.get(), 0);
}
void eventFunctionD() {
X4.led.blink();
}
// Initialize program
void setup() {
// Register event for each function
X4.functionA.addEvent(eventFunctionA);
X4.functionB.addEvent(eventFunctionB);
X4.functionC.addEvent(eventFunctionC);
X4.functionD.addEvent(eventFunctionD);
}
// Loop program
void loop() {
// Empty
}
More example code
You will find new example code for each functionality and module. Now it’s more informative and easier to find.
New X4 features
- Change servo rotation speed
X4.servoA.setSpeed(5)
(RPM) - Play sounds (vibrate) with DC motor
X4.dcAB.tone(500)
(500Hz) - Change DC motor PWM frequency
X4.dcAB.setFreq(50)
(50Hz) - RGB LED fade animations
X4.rgb.fadeColor(0, 255, 255)
(color fade to)
X4.rgb.fadeStart(1000)
(animation duration)
Easy to use event code
Read data without code blocking.
Module11 sensor;
int distance;
void sensorEvent() {
if (sensor.distance.isEvent()) {
distance = sensor.distance.getCm();
}
}
void setup() {
// Register event function for Distance module
sensor.addEvent(sensorEvent);
// Enable events for distance parameter
sensor.distance.event(); // When value is changed
// sensor.distance.event(100); // Call event each 100ms
}
// Loop program
void loop() {
delay(1000);
}