Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. package jBotBrain2.Test;
  2.  
  3. import jBotBrain2.hw.*;
  4. import jBotBrain2.sensors.UltraSonicRangeFinder;
  5.  
  6. public class TestMain {
  7.     public static void main(String[] args) throws InterruptedException {
  8.         Led.GREEN1.set(Led.MODE_BLINK, 100);
  9.  
  10.  
  11.         UltraSonicRangeFinder us = new UltraSonicRangeFinder();
  12.        
  13.         System.out.println("Hello :)");
  14.        
  15.  
  16.        
  17.         boolean i = true;
  18.        
  19.         while (true) {
  20.             System.out.print("US="+us.getDistance()+"    \r");
  21.            
  22.             if (i) {
  23.                 Led.ORANGE.on();
  24.                 i = false;
  25.             } else {
  26.                 Led.ORANGE.off();
  27.                 i = true;
  28.             }
  29.            
  30.             Thread.sleep(200);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement