Saving high resolution frames from serial input
in
Core Library Questions
•
5 months ago
Hello,
I have a little doubt and tried a lot of permutation combination but couldnt arrive at what i want. I basically want all my frames to be recorded in a high resolution pdf for printing.
Following is my code:
[code]
- import processing.serial.*;
- Serial myPort;
- int channels = 10;
- int [] channel = new int[channels];
- int packetCount = 0;
- float x;
- //float easing=1;
- //int last;
- //int millis();
- void setup() {
- size(1000, 1000);
- println(Serial.list());
- String portName= Serial.list() [0];
- myPort= new Serial(this, portName, 9600);
- myPort.bufferUntil(10);
- smooth();
- noFill();
- stroke(160);
- frameRate(24);
- }
- void draw() {
- }
- void serialEvent (Serial myPort) {
- background(0);
- String[] incomingValues = split(myPort.readString(), ',');
- if (incomingValues.length>1) {
- packetCount++;
- println(incomingValues[1]);
- if (incomingValues.length>1)
- {
- stroke(255);
- int amplitude1 = 100-Integer.parseInt(incomingValues[1].trim());
- float y = 0;
- float prevY = 0;
- for (int i = 1; i < width; i++)
- {
- y = sin(radians(i*2))*amplitude1;
- line(i-1, prevY+height/2, i, y+height/2);
- prevY = y;
- x+=0.2;
- }
- }
- }
- }
[/code]
I dont want only one frame to be recorded but multiple of them, where should i put the command?
Thank you for your help.
1