本文整理汇总了Java中lejos.hardware.Button.LEDPattern方法的典型用法代码示例。如果您正苦于以下问题:Java Button.LEDPattern方法的具体用法?Java Button.LEDPattern怎么用?Java Button.LEDPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lejos.hardware.Button
的用法示例。
在下文中一共展示了Button.LEDPattern方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import lejos.hardware.Button; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
GraphicsLCD g = BrickFinder.getDefault().getGraphicsLCD();
final int SW = g.getWidth();
final int SH = g.getHeight();
Button.LEDPattern(4);
Sound.beepSequenceUp();
g.setFont(Font.getDefaultFont());
g.drawString("Lejos EV3 Gradle", SW/2, SH/2, GraphicsLCD.BASELINE|GraphicsLCD.HCENTER);
Button.LEDPattern(3);
Delay.msDelay(4000);
Button.LEDPattern(5);
g.clear();
g.refresh();
Sound.beepSequence();
Delay.msDelay(500);
Button.LEDPattern(0);
}
示例2: stopProgram
import lejos.hardware.Button; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void stopProgram() {
try {
if ( program == null ) {
return;
}
program.destroy();
System.out.println("Waiting for process to die");
;
program.waitFor();
System.out.println("Program finished");
resetMotors();
// Turn the LED off, in case left on
Button.LEDPattern(0);
lcd.setAutoRefresh(true);
lcd.clear();
lcd.refresh();
program = null;
suspend = false;
this.ind.resume();
} catch ( Exception e ) {
System.err.println("Failed to stop program: " + e);
}
}
示例3: doLight
import lejos.hardware.Button; //导入方法依赖的package包/类
private void doLight() {
int temp;
if (color == BUTTON_LED_OFF) {
temp = color;
} else {
temp = color + 3 * blink;
}
Button.LEDPattern(temp);
}
示例4: start
import lejos.hardware.Button; //导入方法依赖的package包/类
public void start() throws InterruptedException
{
arm.initialize();
arm.calibrateHand();
//arm.testHandPosCodeFreely();
//generate interpolated paths from file
List<Path> paths = null;
try {
paths = SVGHandler.pathsInSVGFile(new URI("file:///tmp/job.svg"));
} catch (SVGException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (paths != null) {
//calculate inverse kinematics and draw as soon as first path is calculated
BlockingQueue<List<double[]>> queue = new ArrayBlockingQueue<List<double[]>>(1);
Thread producer = new Thread(new MovementDataProducer(arm, queue, paths));
Thread consumer = new Thread(new MovementController(arm, queue));
producer.setDaemon(true);
consumer.setDaemon(true);
producer.start();
consumer.start();
producer.join();
consumer.join();
System.out.println("Finished all.");
}
Button.LEDPattern(0);
}
示例5: stopApp
import lejos.hardware.Button; //导入方法依赖的package包/类
private void stopApp() {
clock.stop();
Button.LEDPattern(0);
LCD.clear();
Ev3Utils.displayLargeText(
BrickFinder.getDefault().getTextLCD(Font.getLargeFont()),
"Bye!");
log.info("bye");
}
示例6: exec
import lejos.hardware.Button; //导入方法依赖的package包/类
/**
* Execute a program and display its output to System.out and error stream to System.err
*/
private static void exec(File jar, String command, String directory) {
try {
if ( jar != null ) {
String jarName = jar.getName();
programName = jarName.substring(0, jarName.length() - 4); // Remove .jar
}
lcd.clear();
lcd.refresh();
lcd.setAutoRefresh(false);
drawLaunchScreen();
program = new ProcessBuilder(command.split(" ")).directory(new File(directory)).start();
BufferedReader input = new BufferedReader(new InputStreamReader(program.getInputStream()));
BufferedReader err = new BufferedReader(new InputStreamReader(program.getErrorStream()));
echoIn = new EchoThread(jar.getPath().replace(".jar", ".out"), input, System.out);
echoErr = new EchoThread(jar.getPath().replace(".jar", ".err"), err, System.err);
echoIn.start();
echoErr.start();
System.out.println("Executing " + command + " in " + directory);
while ( true ) {
int b = Button.getButtons();
if ( b == 6 ) {
System.out.println("Killing the process");
program.destroy();
// reset motors after program is aborted
resetMotors();
break;
}
if ( !echoIn.isAlive() && !echoErr.isAlive() ) {
break;
}
Delay.msDelay(200);
}
System.out.println("Waiting for process to die");
;
program.waitFor();
System.out.println("Program finished");
} catch ( Exception e ) {
System.err.println("Failed to execute program: " + e);
} finally {
// Turn the LED off, in case left on
Button.LEDPattern(0);
lcd.setAutoRefresh(true);
lcd.clear();
lcd.refresh();
program = null;
}
}
示例7: raceStarting
import lejos.hardware.Button; //导入方法依赖的package包/类
public void raceStarting() {
Button.LEDPattern(4);
Sound.beepSequence();
}
示例8: trackLost
import lejos.hardware.Button; //导入方法依赖的package包/类
public void trackLost() {
Button.LEDPattern(2);
Sound.buzz();
}
示例9: raceFinished
import lejos.hardware.Button; //导入方法依赖的package包/类
public void raceFinished() {
Button.LEDPattern(4);
Sound.beepSequenceUp();
}
示例10: startLightShow
import lejos.hardware.Button; //导入方法依赖的package包/类
private void startLightShow(int pattern) {
startTimeOfLastLightshow = System.currentTimeMillis();
Button.LEDPattern(pattern);
}
示例11: initialize
import lejos.hardware.Button; //导入方法依赖的package包/类
public void initialize()
{
System.out.println("Initializing arm positon...");
Sound.twoBeeps();
Button.LEDPattern(9);
setBothJointsSpeed(500);
// Find home for motor 1
System.out.println("Homing motor1...");
float[] sample = new float[touchSensor1.sampleSize()];
motor1.forward();
do {
touchSensor1.fetchSample(sample, 0);
Thread.yield();
//Delay.msDelay(10);
} while (sample[0] == 0.0);
motor1.stop();
motor1.resetTachoCount();
System.out.println("... motor1 reached home.");
// Find home for motor 2
System.out.println("Homing motor2...");
motor1.rotateTo((int)(-115 * gearRatio1), false);
motor2.forward();
do {
touchSensor2.fetchSample(sample, 0);
Thread.yield();
//Delay.msDelay(10);
} while (sample[0] == 0.0);
motor2.stop();
motor2.resetTachoCount();
System.out.println("... motor2 reached home.");
//Move to position 0, 0 (degrees)
System.out.println("Stretching arm...");
motor1.rotateTo((int)(-94 * gearRatio1), true);
motor2.rotateTo((int)(-1 * 67 * gearRatio2), true);
while (areJointsMoving()){
Thread.yield();
//Delay.msDelay(10);
}
motor1.resetTachoCount();
motor2.resetTachoCount();
System.out.println("... done");
Sound.beepSequenceUp();
Button.LEDPattern(7);
}
示例12: shutdown
import lejos.hardware.Button; //导入方法依赖的package包/类
/**
* Closes motor devices if available.<br>
* Turn off button LEDs.<br>
* Clear and refresh display.<br>
*/
public void shutdown() {
Button.LEDPattern(0);
}