public class ArduinoLink extends Sensor
Connection diagram: Use two resistors 82 kOhm to pull-up line A4 and A5 of Arduino. The Ardunio may be powered from the EV3 by connecting >>>>>>>, otherwise let the Arduino's 5V pin open.
(Never use the VIN pin, because it may have a voltage higher than 5V if the Arduino is external powered.)
The color on the left side corresponds to a standard Lego sensor cable. blue 6 [-----------x-------------------------] A4 | L | A | yellow 5 [-------------------x-----------------] A5 R E | | --- --- D |82K| |82k| G | | | | U | | | | --- --- I O | | green 4 [-----------x-------x---------->>>>>>>] 5V N O red 3 [-------------------------------------] GND black 2 [ white 1 [
Constructor and Description |
---|
ArduinoLink()
Creates a sensor instance connected to port S1.
|
ArduinoLink(SensorPort port)
Creates a sensor instance connected to the given port.
|
Modifier and Type | Method and Description |
---|---|
void |
getReply(int request,
int[] reply)
Returns a integer array of size 16 containing the reply from the
Arduino after sending the request.
|
int |
getReplyInt(int request)
Returns a one byte reply (int in range 0..255).
|
java.lang.String |
getReplyString(int request)
Returns a null-terminated ASCII string reply.
|
public ArduinoLink(SensorPort port)
port
- the port where the sensor is plugged-inpublic ArduinoLink()
public int getReplyInt(int request)
public void getReply(int request, int[] reply)
public java.lang.String getReplyString(int request)