Advertisement
Guest User

Processing code

a guest
Jul 31st, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import processing.serial.*;
  2. Serial port;
  3. int[]bjval;
  4.  
  5. void setup()  
  6. {
  7.   println(Serial.list());
  8.   port = new Serial(this, Serial.list() [0], 9600);
  9.  
  10. }
  11.  
  12. void draw()
  13. {
  14.   if(keyPressed)
  15.   {
  16.      if (key == 'w' || key == 'W') {
  17.       port.write('W');
  18.     }
  19.  if (key == 's' || key == 'S') {
  20.       port.write('S');
  21.     }
  22.  if (key == 'a' || key == 'A') {
  23.       port.write('A');
  24.     }
  25.  if (key == 'd' || key == 'D') {
  26.       port.write('D');
  27.     }
  28.  if (key == 'k' || key == 'K') {
  29.       port.write('K');
  30.     }
  31.  if (key == 'i' || key == 'I') {
  32.       port.write('I');
  33.     }
  34.  if (key == 'j' || key == 'J') {
  35.       port.write('J');
  36.     }
  37.  if (key == 'l' || key == 'L') {
  38.       port.write('L');
  39.     }
  40.   }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement