lemueltra

major_10_05

May 11th, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package br.follow_line;
  2.  
  3. import lejos.nxt.*;
  4.  
  5. public class major {
  6.     static LightSensor light = new LightSensor(SensorPort.S1, true);
  7.     static int preto, branco;
  8.     public static void main(String[] args) throws Exception{
  9.         Motor.A.resetTachoCount(); //Reiniciar contador de ângulo de giro do motor
  10.         Motor.B.resetTachoCount();
  11.        
  12.         System.out.print("Branco");
  13.         Thread.sleep(5000); //Delay de 5 segundos
  14.         branco = light.getNormalizedLightValue(); //Ler dados do sensor de luz
  15.         System.out.println(branco);
  16.        
  17.         System.out.print("Preto");
  18.         Thread.sleep(5000);
  19.         preto = light.getNormalizedLightValue();
  20.         System.out.println(preto);
  21.        
  22.         ler_dados ler_dados = new ler_dados(); //Chamar classe ler_dados via thread
  23.         Thread threadler= new Thread(ler_dados);
  24.         threadler.setPriority(Thread.MAX_PRIORITY);
  25.         threadler.start();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment