BlinkenArea - GitList
Repositories
Blog
Wiki
JEtherPix
Code
Commits
Branches
Tags
Search
Tree:
a74e920
Branches
Tags
master
JEtherPix
org
blinkenarea
JFlexiPix
examples
Blink.java
added additional base index parameter to data() method of display
Stefan Schuermans
commited
a74e920
at 2011-09-11 11:27:59
Blink.java
Blame
History
Raw
/* JFlexiPix - Java implementation of FlexiPix output library * * Copyright 2010-2011 Stefan Schuermans <stefan blinkenarea org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.blinkenarea.JFlexiPix.examples; import org.blinkenarea.JFlexiPix.*; public class Blink { // entry point public static void main(String [] args) { String config; Display display; int width, height, i; byte [] white = {(byte)255, (byte)255, (byte)255}; // check usage if (args.length < 1) { System.out.println("usage: java Blink <config.flp>"); return; } config = args[0]; /* create a display, take configuration from a file, deliver messages to message method of new Msg object */ try { display = new Display(config, new Msg()); } catch (Exception e) { System.out.println("could not create display\n"); e.printStackTrace(); return; } // get size and show it width = display.getWidth(); height = display.getHeight(); System.out.println("display size:"); System.out.println(String.format(" width: %5d", width )); System.out.println(String.format(" height: %5d", height)); // blink display System.out.println("blink"); for (i = 0; i < 5; ++i) { System.out.println("on"); display.data(white, 0, 0, 0, 0, 0, width, height); display.send(); try { Thread.sleep(500); } catch (InterruptedException e) { } System.out.println("off"); display.dataClear(); display.send(); try { Thread.sleep(500); } catch (InterruptedException e) { } } System.out.println("done"); // free display display = null; } }