title: How to use the ObdRawCommand from pires OBD-II Java API to send custom commands
body: <p>Does anyone know how I can send custom commands using the <a href="https://github.com/pires/obd-java-api/blob/master/src/main/java/com/github/pires/obd/commands/protocol/ObdRawCommand.java" rel="nofollow">ObdRawCommand</a> in pires <code>Java</code> api? I have little to no experience with this api and I have contacted the creator but I haven't gotten any answer yet.</p>
  
  <p>I have searched online for some project that uses the ObdRawCommand to send custom commands but I can't find <em>anything</em>.</p>
  
  <p>So any help is appreciated!</p>
  
  <p><strong>Snippet</strong></p>
  
  <pre><code>public void run() {
              OBDcmds();
  
              try {
  
                  ModuleVoltageCommand voltageCommand = new ModuleVoltageCommand();
                  OdbRawCommand command1 = new OdbRawCommand("22 40 28");
  
                  while (!Thread.currentThread().isInterrupted()) {
                      guiHandler(Constants.VOLTAGE_STATUS, 0, voltageCommand.getFormattedResult());
                      guiHandler(Constants.cmd1_STATUS, 0, command1.getFormattedResult());
                      Log.d("Log", "Voltage:" + voltageCommand.getFormattedResult());
                      Log.d("Log", "cmd1:" + command1.getFormattedResult()); //null
  
                      try {
                          voltageCommand.run(mmInStream, mmOutStream);
                          command1.run(mmInStream, mmOutStream);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                  }
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                  System.out.println("inside catch before while");
              }
          }
  
  
  private void OBDcmds() { // execute commands
  
  
              try {
                  new EchoOffCommand().run(mmInStream, mmOutStream);
                  new LineFeedOffCommand().run(mmInStream, mmOutStream);
                  new TimeoutCommand(125).run(mmInStream, mmOutStream);
                  new SelectProtocolCommand(ObdProtocols.AUTO).run(mmInStream, mmOutStream); //ISO_15765_4_CAN
                  new ModuleVoltageCommand().run(mmInStream, mmOutStream);
              } catch (Exception e) {
                  Log.v("OBDcmds", "e");
                  // handle errors
              }
          }
  </code></pre>