public class ArduinoUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
arduinoPath |
static int |
exitValue |
static org.slf4j.Logger |
log |
static StringBuilder |
outputBuilder |
Constructor and Description |
---|
ArduinoUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getExeName() |
static String |
getOutput() |
static String |
RunAndCatch(String cmd,
ArrayList<String> args)
Helper function to run a program , return the stderr / stdout as a string
and to catch any exceptions that occur
|
static String |
runCommand(String program,
ArrayList<String> args)
Helper function to run a system command and return the stdout / stderr as a
string
|
static boolean |
uploadSketch(String port,
String boardKey)
Upload the MrlComm.ino with an arduino ide (version 1.6.8) installed in the
default windows location of C:\Program Files (x86)\Arduino\
|
static boolean |
uploadSketch(String port,
String boardKey,
String arduinoPath)
Upload the MrlComm.ino sketch to the using an arduino IDE (only version
1.6.8 has been tested for this method.)
|
public static final transient org.slf4j.Logger log
public static String arduinoPath
public static StringBuilder outputBuilder
public static int exitValue
public static String getExeName()
public static boolean uploadSketch(String port, String boardKey) throws IOException, InterruptedException
port
- - the com port for the arduinoboardKey
- - the board type mega/unoIOException
- - if there is an error talking to the com portInterruptedException
- - if interrupted by a threadpublic static boolean uploadSketch(String port, String boardKey, String arduinoPath) throws IOException, InterruptedException
port
- the com port (COM4, /dev/ttyAMA0 ...)boardKey
- - the board type mega / unoarduinoPath
- - path to the arduino ide installationIOException
- - if there's a problem reading the source ino sketch or talking
to the com portInterruptedException
- - if interrupted.public static String runCommand(String program, ArrayList<String> args) throws InterruptedException
program
- - the path to the executible to runargs
- - the list of arguments to be passed to the programInterruptedException
- - if interruptedpublic static String RunAndCatch(String cmd, ArrayList<String> args)
cmd
- - the path to the program to runargs
- - a list of args to pass inpublic static String getOutput()
Copyright © 2020 myrobotlab. All rights reserved.