Class SerialPortController
- java.lang.Object
-
- ptolemy.actor.lib.jjs.modules.IMUSensor.SerialPortController
-
public class SerialPortController extends java.lang.Object
This class provides a set of functions for use with an IMUSensor accessor from within Ptolemy II. This thread keeps an object of type ReaderM that starts a thread and continuously reads from the serial port that the sensor is connected on.- Since:
- Ptolemy II 11.0
- Version:
- $Id$, $Id$
- Author:
- Hunter Massey and Rajesh Kuni
- See Also:
ReaderM
- Pt.AcceptedRating:
- Pt.ProposedRating:
- Yellow Hunter
-
-
Constructor Summary
Constructors Constructor Description SerialPortController()
Base constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getSample()
Grab the latest unread sample from the buffer and return it.void
start(int x)
Starts a serial port connection with comm port with number x (ex: COM8).void
stop()
Stops the reading ReaderM thread and terminates the serial connection.
-
-
-
Method Detail
-
start
public void start(int x)
Starts a serial port connection with comm port with number x (ex: COM8).- Parameters:
x
- The serial port number to connect to
-
getSample
public int[] getSample()
Grab the latest unread sample from the buffer and return it. Returns latest sample upon call if read index has caught up to write index.- Returns:
- The latest unread sample, or the latest read sample if write index = read index in buffer
-
stop
public void stop()
Stops the reading ReaderM thread and terminates the serial connection.
-
-