Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.serial.*;
- PImage img;
- Serial port;
- void setup() {
- size(960,540);
- //img = loadImage("GUI.JPG");
- port = new Serial(this, "COM12", 9600);
- }
- void draw() {
- //image(img, 0, 0);
- }
- //function to check for a keyboard key press during the draw loop
- void keyPressed(){
- switch(key) {
- case 'w':
- port.write(0);
- break;
- case 's':
- port.write(1);
- break;
- case 'a':
- port.write(2);
- break;
- case 'd':
- port.write(3);
- break;
- case 'x':
- port.write(4);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement