Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Saving high resolution frames from serial input

$
0
0
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]
  1. import processing.serial.*;

  2. Serial myPort;

  3. int channels = 10;
  4. int [] channel = new int[channels];
  5. int packetCount = 0;

  6. float x;


  7. //float easing=1;
  8. //int last;
  9. //int millis();


  10. void setup() {
  11.   size(1000, 1000);
  12.   println(Serial.list());
  13.   String portName= Serial.list() [0];
  14.   myPort= new Serial(this, portName, 9600);
  15.   myPort.bufferUntil(10);
  16.   smooth();
  17.   noFill();
  18.   stroke(160);
  19.   frameRate(24);

  20. }

  21. void draw() {

  22. }

  23. void serialEvent (Serial myPort) {

  24. background(0);

  25.   String[] incomingValues = split(myPort.readString(), ',');

  26.   if (incomingValues.length>1) {
  27.     packetCount++;
  28.     println(incomingValues[1]);
  29.     
  30.     if (incomingValues.length>1)
  31.     {
  32.       stroke(255);
  33.       int amplitude1 = 100-Integer.parseInt(incomingValues[1].trim());
  34.       

  35.       float y = 0;
  36.       float prevY = 0;


  37.       for (int i = 1; i < width; i++)
  38.       {

  39.         y = sin(radians(i*2))*amplitude1;
  40.         line(i-1, prevY+height/2, i, y+height/2);
  41.         
  42.         prevY = y;
  43.         x+=0.2;
  44.        
  45.       }
  46.   
  47.     }
  48.   }

  49. }
[/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.



Viewing all articles
Browse latest Browse all 1768

Trending Articles