@@ -13,8 +13,8 @@ import java.nio.ByteOrder;
13
13
Serial myPort;
14
14
15
15
// must match resolution used in the sketch
16
- final int cameraWidth = 324 ;
17
- final int cameraHeight = 244 ;
16
+ final int cameraWidth = 320 ;
17
+ final int cameraHeight = 240 ;
18
18
final int cameraBytesPerPixel = 1 ;
19
19
final int bytesPerFrame = cameraWidth * cameraHeight * cameraBytesPerPixel;
20
20
@@ -23,14 +23,14 @@ byte[] frameBuffer = new byte[bytesPerFrame];
23
23
24
24
void setup ()
25
25
{
26
- size (324 , 244 );
26
+ size (640 , 480 );
27
27
28
28
// if you have only ONE serial port active
29
29
// myPort = new Serial(this, Serial.list()[0], 9600); // if you have only ONE serial port active
30
30
31
31
// if you know the serial port name
32
32
// myPort = new Serial(this, "COM5", 9600); // Windows
33
- myPort = new Serial (this , " /dev/ttyACM0" , 9600 ); // Linux
33
+ myPort = new Serial (this , " /dev/ttyACM0" , 921600 ); // Linux
34
34
// myPort = new Serial(this, "/dev/cu.usbmodem14401", 9600); // Mac
35
35
36
36
// wait for full frame of bytes
@@ -41,10 +41,13 @@ void setup()
41
41
42
42
void draw ()
43
43
{
44
- image (myImage, 0 , 0 );
44
+ PImage img = myImage. copy();
45
+ img. resize(640 , 480 );
46
+ image (img, 0 , 0 );
45
47
}
46
48
47
49
void serialEvent (Serial myPort ) {
50
+ // println("serial data");
48
51
// read the saw bytes in
49
52
myPort. readBytes(frameBuffer);
50
53
0 commit comments