Search in sources :

Example 1 with Color

use of com.robo4j.hw.rpi.i2c.adafruitlcd.Color in project robo4j by Robo4J.

the class ColorDemo method run.

@Override
public void run(AdafruitLcd lcd) throws IOException {
    lcd.clear();
    lcd.setText("Color changes:");
    Util.sleep(1000);
    for (Color c : Color.values()) {
        lcd.setText(1, "Color: " + c.toString() + "      ");
        lcd.setBacklight(c);
        Util.sleep(1000);
    }
    lcd.setBacklight(Color.ON);
    lcd.clear();
    lcd.setText("Backlight Test:\nDone!");
}
Also used : Color(com.robo4j.hw.rpi.i2c.adafruitlcd.Color)

Example 2 with Color

use of com.robo4j.hw.rpi.i2c.adafruitlcd.Color in project robo4j by Robo4J.

the class ColorDemo method runDemo.

@Override
public void runDemo() {
    String prefix = "Color changes:\n";
    lcd.sendMessage(LcdMessage.MESSAGE_CLEAR);
    int delay = 0;
    int i = 0;
    for (; i < Color.values().length - 1; i++) {
        Color c = Color.values()[i];
        scheduler.schedule(lcd, getColorMessage(prefix, c), delay += 1, 1, TimeUnit.SECONDS, 1);
    }
    scheduler.schedule(lcd, getColorMessage(prefix, Color.values()[i]), delay += 1, 1, TimeUnit.SECONDS, 1, (RoboContext context) -> {
        lcd.sendMessage(new LcdMessage(getName() + " Demo:\nDone!", Color.ON));
        setDone();
    });
}
Also used : Color(com.robo4j.hw.rpi.i2c.adafruitlcd.Color) RoboContext(com.robo4j.RoboContext)

Aggregations

Color (com.robo4j.hw.rpi.i2c.adafruitlcd.Color)2 RoboContext (com.robo4j.RoboContext)1