We keep getting this error:
ERROR 1 Unhandled exception: java.lang.NullPointerException frc.robot.subsystems.ArduinoSubsystem.write(ArduinoSubsystem.java:29)
In our command file, we have
protected void execute() {
Robot.LED.write("1");
}
And our subsystem file has
public void write(String input){//writes to the arduino
char[] CharArray = input.toCharArray();//creates a char array from the input string
byte[] WriteData = new byte[CharArray.length];//creates a byte array from the char array
for (int i = 0; i < CharArray.length; i++) {//writes each byte to the arduino
WriteData[i] = (byte)CharArray[i];//adds the char elements to the byte array
}
Wire.transaction(WriteData, WriteData.length, null, 0);//sends each byte to arduino
}
Why is this creating this error? All we want is to send integer values to the arduino.