SHOW:
|
|
- or go back to the newest paste.
| 1 | public void serialEvent (DummySerialPortEvent event) | |
| 2 | {
| |
| 3 | String temp = ""; | |
| 4 | if (event.getEventType() == DummySerialPortEvent.DATA_AVAILABLE) | |
| 5 | {
| |
| 6 | try | |
| 7 | {
| |
| 8 | String temp1, temp2, temp3, temp4; | |
| 9 | while (input.available() > 0) | |
| 10 | {
| |
| 11 | int character = input.read(); | |
| 12 | temp +=(char)character; | |
| 13 | } | |
| 14 | ||
| 15 | addDebugTekst(temp); | |
| 16 | temp1 = temp.substring(0,temp.indexOf("cb")-1);
| |
| 17 | temp2 = temp.substring(temp.indexOf("cb"),temp.indexOf("cc")-1);
| |
| 18 | temp3 = temp.substring(temp.indexOf("cc"),temp.indexOf("cd")-1);
| |
| 19 | temp4 = temp.substring(temp.indexOf("cd"));
| |
| 20 | if(temp1.substring(3,4).equals("-"))geefWaarde(Float.valueOf(temp1.substring(3,8)).floatValue()); // Kijk of het een negatief getal is
| |
| 21 | else geefWaarde(Float.valueOf(temp1.substring(3,7)).floatValue()); | |
| 22 | if(temp2.substring(3,4).equals("-"))geefWaarde2(Float.valueOf(temp2.substring(3,8)).floatValue()); // Kijk of het een negatief getal is
| |
| 23 | else geefWaarde2(Float.valueOf(temp2.substring(3,7)).floatValue()); | |
| 24 | if(temp3.substring(3,4).equals("-"))geefWaarde3(Float.valueOf(temp3.substring(3,8)).floatValue()); // Kijk of het een negatief getal is
| |
| 25 | else geefWaarde3(Float.valueOf(temp3.substring(3,7)).floatValue()); | |
| 26 | if(temp4.substring(3,4).equals("-"))geefWaarde4(Float.valueOf(temp4.substring(3,8)).floatValue()); // Kijk of het een negatief getal is
| |
| 27 | else geefWaarde4(Float.valueOf(temp4.substring(3,7)).floatValue()); | |
| 28 | } | |
| 29 | catch(IOException e) {}
| |
| 30 | } | |
| 31 | } |