Skip to content

Commit 2a05f69

Browse files
committed
Update Processing example.
* Use faster baudrate. * Upscale image to VGA for better viewing.
1 parent d74ada2 commit 2a05f69

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: libraries/Portenta_Camera/extras/CameraRawBytesVisualizer/CameraRawBytesVisualizer.pde

+8-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import java.nio.ByteOrder;
1313
Serial myPort;
1414

1515
// 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;
1818
final int cameraBytesPerPixel = 1;
1919
final int bytesPerFrame = cameraWidth * cameraHeight * cameraBytesPerPixel;
2020

@@ -23,14 +23,14 @@ byte[] frameBuffer = new byte[bytesPerFrame];
2323

2424
void setup()
2525
{
26-
size(324, 244);
26+
size(640, 480);
2727

2828
// if you have only ONE serial port active
2929
//myPort = new Serial(this, Serial.list()[0], 9600); // if you have only ONE serial port active
3030

3131
// if you know the serial port name
3232
//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
3434
//myPort = new Serial(this, "/dev/cu.usbmodem14401", 9600); // Mac
3535

3636
// wait for full frame of bytes
@@ -41,10 +41,13 @@ void setup()
4141

4242
void draw()
4343
{
44-
image(myImage, 0, 0);
44+
PImage img = myImage.copy();
45+
img.resize(640, 480);
46+
image(img, 0, 0);
4547
}
4648

4749
void serialEvent(Serial myPort) {
50+
//println("serial data");
4851
// read the saw bytes in
4952
myPort.readBytes(frameBuffer);
5053

0 commit comments

Comments
 (0)