mirror of
https://github.com/JonasunderscoreJones/Microcraft.git
synced 2025-10-24 20:29:17 +02:00
removed unneeded debug code
This commit is contained in:
parent
a3e214f3a1
commit
5b0bac3caf
2 changed files with 0 additions and 83 deletions
|
|
@ -1,48 +0,0 @@
|
|||
package me.jonasjones.arduinoctrls.debug;
|
||||
|
||||
import arduino.Arduino;
|
||||
import me.jonasjones.arduinoctrls.ArduinoControls;
|
||||
|
||||
public class LedBlink {
|
||||
public static void initialisation() throws InterruptedException {
|
||||
|
||||
//do portscan
|
||||
//String port = (new SPortScan()).getActivePort();
|
||||
String port = "/dev/ttyUSB0";
|
||||
//establish connection to Ardiuno
|
||||
Arduino ArduinoCon = new Arduino(port, 9600);
|
||||
boolean isOn = true; //Led state off
|
||||
String[] commands = {"turnOff", "turnOn"}; //commands for Arduino
|
||||
|
||||
ArduinoCon.openConnection();
|
||||
Thread.sleep(4000);
|
||||
ArduinoCon.serialWrite(commands[1]);
|
||||
Thread.sleep(1000);
|
||||
ArduinoCon.serialWrite(commands[0]);
|
||||
Thread.sleep(1000);
|
||||
ArduinoCon.serialWrite(commands[1]);
|
||||
Thread.sleep(1000);
|
||||
ArduinoCon.serialWrite(commands[0]);
|
||||
ArduinoCon.closeConnection();
|
||||
}
|
||||
|
||||
public static boolean blink(Arduino ArduinoCon, String[] commands, boolean isOn) throws InterruptedException {
|
||||
ArduinoCon.openConnection();
|
||||
Thread.sleep(4000);
|
||||
isOn = !isOn;
|
||||
if (isOn) {
|
||||
ArduinoCon.serialWrite(commands[1]);
|
||||
} else {
|
||||
ArduinoCon.serialWrite(commands[0]);
|
||||
}
|
||||
ArduinoCon.closeConnection();
|
||||
return isOn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package me.jonasjones.arduinoctrls.debug;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
import gnu.io.*;
|
||||
import me.jonasjones.arduinoctrls.ArduinoControls;
|
||||
|
||||
public class SPortScan {
|
||||
private String activePort;
|
||||
|
||||
public SPortScan(){
|
||||
CommPortIdentifier serialPortId;
|
||||
|
||||
Enumeration enumComm;
|
||||
|
||||
enumComm = CommPortIdentifier.getPortIdentifiers(); // get active ports
|
||||
ArduinoControls.LOGGER.info("Found Ports: " + enumComm.toString());
|
||||
|
||||
/*
|
||||
go throught ports and identify the serial
|
||||
*/
|
||||
while(enumComm.hasMoreElements())
|
||||
{
|
||||
serialPortId = (CommPortIdentifier) enumComm.nextElement(); // get next one
|
||||
if(serialPortId.getPortType() == CommPortIdentifier.PORT_SERIAL) // check if is serial type
|
||||
{
|
||||
this.activePort = (String) serialPortId.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getActivePort(){
|
||||
return this.activePort;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue