User Tools

Site Tools


the_ledtester_class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
the_ledtester_class [2018/08/11 01:05] frchristhe_ledtester_class [2018/08/11 01:10] (current) frchris
Line 10: Line 10:
 public class LEDTester public class LEDTester
 { {
-     public LED pin1;+    public LED pin1;
          
     //unit of time, in milliseconds     //unit of time, in milliseconds
Line 19: Line 19:
                  
         String s = "SOS SOS SOS";         String s = "SOS SOS SOS";
-        // +//          
-        if (args.length > 0 && args[0] != null && !args[0].equals("") )+          if ( args.length > 0 && args[0] != null && !args[0].equals ("") )
             s = args[0];             s = args[0];
-    +        
         lt.flashMorse(s);         lt.flashMorse(s);
         lt.finalize();         lt.finalize();
     }     }
 +    
     /*     /*
      * create a new LED instance      * create a new LED instance
Line 39: Line 40:
         pin1 = p;         pin1 = p;
     }     }
- +    
     /*     /*
      * Flashes the LED 10 times      * Flashes the LED 10 times
      */      */
     public void flash10Times() {     public void flash10Times() {
-         for(int i = 0; i < 10; i++) {+         
 +        for(int i = 0; i < 10; i++) {
             pin1.flash(200);             pin1.flash(200);
-            try { Thread.sleep(200; } catch (InterruptedException e) {}+            try { Thread.sleep (200); } catch (InterruptedException e) {}
         }         }
     }     }
 +    
 +    
     /*     /*
      * Sends the morse code using the LED.      * Sends the morse code using the LED.
Line 64: Line 68:
                     pin1.flash(3*UNIT);                     pin1.flash(3*UNIT);
                 } else if (atom == '/') {   // inter-symbol gap                 } else if (atom == '/') {   // inter-symbol gap
-                    sleep(1;   // plus one leading and one trailing == 3+                    sleep (1);   // plus one leading and one trailing == 3
                 } else {                 } else {
                     // must be a space                     // must be a space
-                    sleep(5;   // plus one leading and one trailing == 7+                    sleep (5);   // plus one leading and one trailing == 7
                 }                 }
                 sleep (1);   // common gap                 sleep (1);   // common gap
Line 81: Line 85:
         {         {
         }         }
-    } 
-    /* 
-     * create a new LED instance 
-     */ 
-    public LEDTester() { 
-        this(new LED()); 
     }     }
     protected void finalize(){     protected void finalize(){
         pin1.finalize();         pin1.finalize();
-    }  +    }        
 } }
 </file> </file>
  
the_ledtester_class.1533963913.txt.gz · Last modified: 2018/08/11 01:05 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki