当前位置: 首页>>代码示例>>Java>>正文


Java Button.LEDPattern方法代码示例

本文整理汇总了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); 
}
 
开发者ID:jornfranke,项目名称:lejos-ev3-example,代码行数:21,代码来源:RobotApplication.java

示例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);
    }
}
 
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:28,代码来源:GraphicStartup.java

示例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);
}
 
开发者ID:jbenech,项目名称:gnikrap,代码行数:10,代码来源:SimpleEV3Led.java

示例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);
}
 
开发者ID:stahlfabrik,项目名称:TRAC3R,代码行数:38,代码来源:TRAC3R.java

示例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");
}
 
开发者ID:rafalmag,项目名称:EV3-projects,代码行数:10,代码来源:MainWithMenu.java

示例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;
    }
}
 
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:57,代码来源:GraphicStartup.java

示例7: raceStarting

import lejos.hardware.Button; //导入方法依赖的package包/类
public void raceStarting() {
	Button.LEDPattern(4);	
	Sound.beepSequence();
}
 
开发者ID:phllipo,项目名称:RoboRace,代码行数:5,代码来源:AudioVideoController.java

示例8: trackLost

import lejos.hardware.Button; //导入方法依赖的package包/类
public void trackLost() {
	Button.LEDPattern(2);	
	Sound.buzz();
}
 
开发者ID:phllipo,项目名称:RoboRace,代码行数:5,代码来源:AudioVideoController.java

示例9: raceFinished

import lejos.hardware.Button; //导入方法依赖的package包/类
public void raceFinished() {
	Button.LEDPattern(4);	
	Sound.beepSequenceUp();
}
 
开发者ID:phllipo,项目名称:RoboRace,代码行数:5,代码来源:AudioVideoController.java

示例10: startLightShow

import lejos.hardware.Button; //导入方法依赖的package包/类
private void startLightShow(int pattern) {
	startTimeOfLastLightshow = System.currentTimeMillis();
	Button.LEDPattern(pattern);
}
 
开发者ID:phllipo,项目名称:RoboRace,代码行数:5,代码来源:AudioVideoController.java

示例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);
}
 
开发者ID:stahlfabrik,项目名称:TRAC3R,代码行数:61,代码来源:TRAC3RsArm.java

示例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);
}
 
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:9,代码来源:RobertaFunctions.java


注:本文中的lejos.hardware.Button.LEDPattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。