-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessing_code.c
More file actions
66 lines (63 loc) · 1.24 KB
/
Copy pathprocessing_code.c
File metadata and controls
66 lines (63 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import processing.serial.*;
Serial myPort; // Create object from Serial class
void setup()
{
size(200,200); //make our canvas 200 x 200 pixels big
println(Serial.list());
String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc. to match your port
myPort = new Serial(this, portName, 9600);
}
void draw()
{
int count=0;
if (keyPressed == true)
{
if (key=='d')
{ myPort.write("d");
println(key);
delay(100);
}
if (key=='s')
{ myPort.write("s");
println(key);
delay(100);
}
if (key=='a')
{ myPort.write("a");
println(key);
delay(100);
}
if (key=='w')
{ myPort.write("w");
println(key);
delay(100);
}
if (key=='i')
{ myPort.write("i");
println(key);
delay(100);
}
if (key=='k')
{ myPort.write("k");
println(key);
delay(100);
}
if (key=='j')
{ myPort.write("j");
println(key);
delay(100);
}
if (key=='l')
{ myPort.write("l");
println(key);
delay(100);
}
if (key=='c')
{ myPort.write("c");
println(key);
delay(100);
}
}
else
println("__INVALID/NO INPUT__");
}