Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String userInput = bufferedReader.readLine(); // reads a user-inputted string of text byte[] byteArray = userInput.getBytes(); // text is converted into byte array and stored in byteArraint parityBit = 0; // creates the parity valuefor ( int b: byteArray){ parityBit += b; // every byte is added to the parity bit}byteArray.add(parityBit%2); // the parityBit modulo two is added to the byte array. if paritybit is even, 0 is added. if parityBit is odd, 1 is addedSerial serial = new Serial(new PApplet()); // opens up a serial portserial.write(byteArray); // bytearray is sent over serial
Add Comment
Please, Sign In to add comment