-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some generic changes that were done without forethought (bug fixes?)
- Loading branch information
1 parent
919962a
commit ee7907e
Showing
4 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/org/jointheleague/jcodrone/examples/DomDrone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.jointheleague.jcodrone.examples; | ||
|
||
import org.jointheleague.jcodrone.CoDrone; | ||
import org.jointheleague.jcodrone.CoDroneNotFoundException; | ||
import org.jointheleague.jcodrone.LightModeBuilder; | ||
import org.jointheleague.jcodrone.MessageNotSentException; | ||
import org.jointheleague.jcodrone.protocol.light.LightMode; | ||
import org.jointheleague.jcodrone.protocol.light.LightModeDrone; | ||
|
||
public class DomDrone { | ||
|
||
public static final int TIME_UNIT = 250; | ||
|
||
public static void main(String args[]) { | ||
try (CoDrone drone = new CoDrone()) { | ||
drone.connect(); | ||
// Thread.sleep(2000); | ||
// LightMode mode= new LightModeBuilder().setColor("BLUE").setMode(LightModeDrone.EYE_HOLD).build(); | ||
// drone.lightMode(mode); | ||
// Thread.sleep(2000); | ||
// mode= new LightModeBuilder().setColor("orange").setMode(LightModeDrone.ARM_NONE).build(); | ||
// drone.lightMode(mode); | ||
// Thread.sleep(2000); | ||
drone.land(); | ||
Thread.sleep(2000); | ||
|
||
String pattern = "...---..."; | ||
for (byte a : pattern.getBytes()) { | ||
int interval = a == '.' ? TIME_UNIT : 3 * TIME_UNIT; | ||
System.out.format("%c %d", a, interval); | ||
LightMode mode2 = new LightModeBuilder() | ||
.setColor("magenta") | ||
.setMode(LightModeDrone.EYE_HOLD) | ||
.build(); | ||
drone.lightMode(mode2); | ||
Thread.sleep(interval); | ||
mode2 = new LightModeBuilder() | ||
.setColor("magenta") | ||
.setMode(LightModeDrone.EYE_NONE) | ||
.build(); | ||
drone.lightMode(mode2); | ||
Thread.sleep(TIME_UNIT); | ||
} | ||
Thread.sleep(2000); | ||
drone.land(); | ||
} catch (CoDroneNotFoundException | InterruptedException | MessageNotSentException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters