Dieses Arduino-Programm steuert die RGB-LEDs des mBot. Es setzt die linke LED (LED_LEFT) auf Rot und die rechte (LED_RIGHT) auf Blau. Nach 500 ms wechseln beide LEDs auf Weiß. Dieser Wechsel wiederholt sich kontinuierlich.
Listing 1:MinimalesProgramm.ino
#include <MeMCore.h>
MeRGBLed led(0, 2); // must be fixed!
int PIN_LED = 13 ; // must be fixed!
int LED_LEFT = 1;
int LED_RIGHT = 0;
int wait = 500;
void setup() {
led.setpin(PIN_LED);
}
void loop() {
led.setColorAt(LED_LEFT, 255, 0, 0); //Set LED1 to Red
led.setColorAt(LED_RIGHT, 0, 0, 255); //Set LED0 to Blue
led.show();
delay(wait);
led.setColorAt(LED_LEFT, 255, 255, 255);
led.setColorAt(LED_RIGHT, 255, 255, 255);
led.show();
delay(wait);
}