<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with #serial - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23serial</link>
      <pubDate>Sun, 08 Aug 2021 18:34:41 +0000</pubDate>
         <description>Tagged with #serial - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23serial/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Detecting CTRL+C keyboard combo and sending over serial</title>
      <link>https://forum.processing.org/two/discussion/9335/detecting-ctrl-c-keyboard-combo-and-sending-over-serial</link>
      <pubDate>Sun, 08 Feb 2015 10:33:46 +0000</pubDate>
      <dc:creator>anjchang</dc:creator>
      <guid isPermaLink="false">9335@/two/discussions</guid>
      <description><![CDATA[<p>Just a quick question-- Is there any way to get Processing to detect that you've hit "CTRL+C" in the keyboard and then send it out over serial?
I'm trying to do this while communicating to an MSP430 but it doesn't seem to be working.
      if (typedCharacterString.indexOf("ctrl")==0) {
        port.write(0x03);
        port.write(0x10);
      }
?? Thanks for any suggestions. anj</p>
]]></description>
   </item>
   <item>
      <title>Capacitive Sensor Within Processing</title>
      <link>https://forum.processing.org/two/discussion/21205/capacitive-sensor-within-processing</link>
      <pubDate>Mon, 06 Mar 2017 18:44:13 +0000</pubDate>
      <dc:creator>harrisonh555</dc:creator>
      <guid isPermaLink="false">21205@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'm novice at using Processing.</p>

<p>In my code I want to change the background to white when the capacitive sensor is held down, and then back to black when the sensor is released.</p>

<p>I have attempted at writing this code in both capacitive sensor code in Arduino, however when I run my code in Processing nothing is shown or changes.</p>

<p>Any help would be greatly appreciated.</p>

<p>MY ARDUINO CODE IS BELLOW</p>

<pre><code>#include &lt;CapacitiveSensor.h&gt;

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);             

void setup(){

  cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     
  Serial.begin(9600);
}

void loop(){

  long start = millis();
  long total1 =  cs_4_2.capacitiveSensor(30);

  Serial.println(total1); 
  Serial.print(",");                

  delay(10);                              
}
</code></pre>

<p>MY PROCESSING CODE IS BELLOW</p>

<pre><code>import processing.serial.*;

int touch1Value = 0;

int threshold = 30;

Serial myPort;

void setup(){

  size (500,500);

  myPort = new Serial(this, Serial.list()[1], 9600);

  myPort.bufferUntil('\n');
}

void draw(){

  background (0);

  println("touch1Value:"+touch1Value);

  if (touch1Value == 1){

    background (255,255,255);
  }
}

void serialEvent(Serial myPort){

  String inString = myPort.readStringUntil('\n');

  if (inString != null){

    inString = trim (inString);

    float[] touches = float (split(inString, ","));

    if (touches.length &gt;=1){

      touch1Value = touches[0] &gt;= threshold ? 1: 0;
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Serial communication between Android and PC?</title>
      <link>https://forum.processing.org/two/discussion/20489/serial-communication-between-android-and-pc</link>
      <pubDate>Thu, 26 Jan 2017 19:23:01 +0000</pubDate>
      <dc:creator>CK_KoopaTroopa</dc:creator>
      <guid isPermaLink="false">20489@/two/discussions</guid>
      <description><![CDATA[<p>Didn't want to ask this because there is a lot of stuff out there on this topic, but I just can't seem to get it working. The main tutorial I've followed can be found <a rel="nofollow" href="http://journeytounknownsoundscapes.blogspot.com/2013/12/how-to-arduino-with-android-really-good.html">here</a>.</p>

<p>I've installed <a rel="nofollow" href="https://sourceforge.net/projects/procandser/">AndroidSerial</a>, exported my project as a signed package, added the device filter lines in AndroidManifest.xml, created the xml directory in the res directory, and copied <a rel="nofollow" href="https://github.com/mik3y/usb-serial-for-android/blob/master/usbSerialExamples/src/main/res/xml/device_filter.xml">device_filter.xml</a> into it, but when I try to build it it throws "Error: No resource found that matches the given name (at 'resource' with value '@xml/device_filter')."</p>

<p>I just want to send readable data from my phone to the PC, it doesn't seem like it should be this complicated especially considering it already has built-in console debugging with print()... Any ideas?</p>
]]></description>
   </item>
   <item>
      <title>Combine Processing+Arduino+Leapmotion</title>
      <link>https://forum.processing.org/two/discussion/19750/combine-processing-arduino-leapmotion</link>
      <pubDate>Wed, 14 Dec 2016 18:22:41 +0000</pubDate>
      <dc:creator>Klansie</dc:creator>
      <guid isPermaLink="false">19750@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I'm combining leapmotion, processing and arduino,
I use the leapmotion for processing library, and the way I do is if leapmotion detected hand, send '1' to serial port which is for arduino, and if there's no hand, send'0'. After receive 1, arduino turn on the relay, receive 0 turn off.  but I failed and I can't figure out which part is the mistake, here is my code :</p>

<p>Processing :</p>

<pre><code>        import de.voidplus.leapmotion.*;
        import processing.serial.*;

        Serial myPort;

        LeapMotion leap ; 

        void setup () {
          size(800, 500);
          background(255);
          leap = new LeapMotion(this);
          String portName = Serial.list()[2]; //change the 0 to a 1 or 2 etc. to match your port
          myPort = new Serial(this, portName, 9600);
        }
        void draw() {
          int number=0;
          for (Hand hand : leap.getHands() ) {
            number=hand.countFingers();
          }
          println(number);

          if (number!= 0) 
          {                           
            myPort.write('1');         //send a 1
            println("1");
          } else 
          {                           //otherwise
            myPort.write('0');          //send a 0
          }


        }
</code></pre>

<p>Arduino :</p>

<pre><code>    char val; // Data received from the serial port
    int ledPin = 13; // Set the pin to digital I/O 13

    void setup() {
      pinMode(ledPin, OUTPUT); 
      Serial.begin(9600); 
    }
    void loop() {
      if (Serial.available())
      { // If data is available to read,
        val = Serial.read(); 
        }

      if (val == '1')
      { // If 1 was received
        digitalWrite(ledPin, HIGH); 
      } else {
        digitalWrite(ledPin, LOW); 
      }
      delay(10); 
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Error, disabling serialEvent() for COM10 null</title>
      <link>https://forum.processing.org/two/discussion/19049/error-disabling-serialevent-for-com10-null</link>
      <pubDate>Tue, 15 Nov 2016 09:44:03 +0000</pubDate>
      <dc:creator>manciu</dc:creator>
      <guid isPermaLink="false">19049@/two/discussions</guid>
      <description><![CDATA[<p>Hi. I'm writing a program that "talk" with an ELM327. If I run the program on my desktop I haven't problems, but if I execute the same program on my portable small computer with ATOM processor, I fight with the error. With winXP the communication exist for about 5 second (but the data are confused) and then arrive the error. If I use LUbuntu the error arrive immediatly after the port initialization.
For develop the program in my house, I made an emulator with an Arduino Micro that has no problems.</p>
]]></description>
   </item>
   <item>
      <title>Separating Data from One IMU Sensor</title>
      <link>https://forum.processing.org/two/discussion/9797/separating-data-from-one-imu-sensor</link>
      <pubDate>Tue, 10 Mar 2015 16:46:06 +0000</pubDate>
      <dc:creator>Cora</dc:creator>
      <guid isPermaLink="false">9797@/two/discussions</guid>
      <description><![CDATA[<p>I'm using an MPU 6050 accel/gyro breakout board with an Arduino Uno for my Processing sketch. Its connected to the MPU 6050 raw sketch. I'm having trouble figuring out how to use the input from my sensor and dividing the number output to use separately. All of the tutorials online are for more than one sensor. What I want to do is compare the out put against each other and I have not been able to find any online resources that talk about using data in that way in processing. I feel like it has something to do with serialEvent. Any help would be greatly appreciated. If anyone knows any online resources that talks about data and serial in processing in more depth. Do I need to install a library? I'm very new to processing.
Here is the MPU6050 raw code:</p>

<pre><code>#include "I2Cdev.h"
#include "MPU6050.h"

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
//MPU6050 accelgyro(0x69); // &lt;-- use for AD0 high

int16_t ax, ay, az;
int16_t gx, gy, gz;



// uncomment "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated
// list of the accel X/Y/Z and then gyro X/Y/Z values in decimal. Easy to read,
// not so easy to parse, and slow(er) over UART.
#define OUTPUT_READABLE_ACCELGYRO

// uncomment "OUTPUT_BINARY_ACCELGYRO" to send all 6 axes of data as 16-bit
// binary, one right after the other. This is very fast (as fast as possible
// without compression or data loss), and easy to parse, but impossible to read
// for a human.
//#define OUTPUT_BINARY_ACCELGYRO


#define LED_PIN 13
bool blinkState = false;

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif

    // initialize serial communication
    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
    // it's really up to you depending on your project)
    Serial.begin(38400);

    // initialize device
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

    // use the code below to change accel/gyro offset values
    /*
    Serial.println("Updating internal sensor offsets...");
    // -76  -2359   1688    0   0   0
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    accelgyro.setXGyroOffset(220);
    accelgyro.setYGyroOffset(76);
    accelgyro.setZGyroOffset(-85);
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    */

    // configure Arduino LED for
    pinMode(LED_PIN, OUTPUT);
}

void loop() {
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&amp;ax, &amp;ay, &amp;az, &amp;gx, &amp;gy, &amp;gz);

    // these methods (and a few others) are also available
    //accelgyro.getAcceleration(&amp;ax, &amp;ay, &amp;az);
    //accelgyro.getRotation(&amp;gx, &amp;gy, &amp;gz);

    #ifdef OUTPUT_READABLE_ACCELGYRO
        // display tab-separated accel/gyro x/y/z values
        Serial.print("a/g:\t");
        Serial.print(ax); Serial.print("\t");
        Serial.print(ay); Serial.print("\t");
        Serial.print(az); Serial.print("\t");
        Serial.print(gx); Serial.print("\t");
        Serial.print(gy); Serial.print("\t");
        Serial.println(gz);
    #endif

    #ifdef OUTPUT_BINARY_ACCELGYRO
        Serial.write((uint8_t)(ax &gt;&gt; 8)); Serial.write((uint8_t)(ax &amp; 0xFF));
        Serial.write((uint8_t)(ay &gt;&gt; 8)); Serial.write((uint8_t)(ay &amp; 0xFF));
        Serial.write((uint8_t)(az &gt;&gt; 8)); Serial.write((uint8_t)(az &amp; 0xFF));
        Serial.write((uint8_t)(gx &gt;&gt; 8)); Serial.write((uint8_t)(gx &amp; 0xFF));
        Serial.write((uint8_t)(gy &gt;&gt; 8)); Serial.write((uint8_t)(gy &amp; 0xFF));
        Serial.write((uint8_t)(gz &gt;&gt; 8)); Serial.write((uint8_t)(gz &amp; 0xFF));
    #endif

    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Why can't processing find "Serial" when I build my library?</title>
      <link>https://forum.processing.org/two/discussion/16667/why-can-t-processing-find-serial-when-i-build-my-library</link>
      <pubDate>Wed, 18 May 2016 00:46:54 +0000</pubDate>
      <dc:creator>Reenforcements</dc:creator>
      <guid isPermaLink="false">16667@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>I'm trying to make a library which depends on the core.jar and serial.jar from Processing. I couldn't figure out how to have multiple class paths, so I copied both the jars and their respective native libraries into a folder and set that as "classpath.local.location" in the build.properties. I also added the libraries as external jars to eclipse. For some reason, it can't find "Serial" as a symbol though. Why is this? Also, if anyone knows how I can reference both libraries directly from Processing instead of copying them that'd be great too!</p>

<p>Thanks you for sacrificing your precious time to help. Here's the log from an ant build. I copied the part in question below but I have the full log too.</p>

<p>Part in question:</p>

<pre><code>  [javadoc] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src/jsonrpc/library/JSONRPC.java:49: error: cannot find symbol
  [javadoc]     private Serial serial;
  [javadoc]             ^
  [javadoc]   symbol:   class Serial
  [javadoc]   location: class JSONRPC
  [javadoc] javadoc: warning - Error fetching URL: <a href="http://processing.org/reference/javadoc/core/" target="_blank" rel="nofollow">http://processing.org/reference/javadoc/core/</a>
</code></pre>

<p>Full:</p>

<pre><code>Buildfile: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/resources/build.xml
init:
     [echo] ------------------------------------------------------------------------------------------------
     [echo]     Building the Processing library JSONRPC 1
     [echo] ------------------------------------------------------------------------------------------------
     [echo]     src path        /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/src
     [echo]     bin path        /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/bin
     [echo]     classpath.local /Applications/Processing/defaultlibs
     [echo]     sketchbook      /Applications/Processing
     [echo]     java version    1.7
     [echo] ------------------------------------------------------------------------------------------------
     [echo]     
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/bin
library.init:
     [echo] init library ...
library.run:
     [echo] building library ...
generate.structure:
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/library
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/examples
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/reference
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/examples
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src
generate.source:
generate.source.win:
generate.source.nix:
     [echo] generating source (mac/linux) ...
parse.file:
     [echo] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src/jsonrpc/library/JSONRPC.java
compile:
    [javac] Compiling 1 source file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/bin
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning
     [copy] Copied 1 empty directory to 1 empty directory under /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/bin/data
generate.jar:
      [jar] Building jar: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/library/JSONRPC.jar
generate.javadoc:
  [javadoc] Generating Javadoc
  [javadoc] Javadoc execution
  [javadoc] Loading source file /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src/jsonrpc/library/JSONRPC.java...
  [javadoc] Constructing Javadoc information...
  [javadoc] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src/jsonrpc/library/JSONRPC.java:32: error: package processing.serial does not exist
  [javadoc] import processing.serial.*;
  [javadoc] ^
  [javadoc] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/src/jsonrpc/library/JSONRPC.java:49: error: cannot find symbol
  [javadoc]     private Serial serial;
  [javadoc]             ^
  [javadoc]   symbol:   class Serial
  [javadoc]   location: class JSONRPC
  [javadoc] javadoc: warning - Error fetching URL: <a href="http://processing.org/reference/javadoc/core/" target="_blank" rel="nofollow">http://processing.org/reference/javadoc/core/</a>
  [javadoc] Registered Taglet ExampleTaglet ...
  [javadoc] Standard Doclet version 1.8.0_77
  [javadoc] Building tree for all the packages and classes...
  [javadoc] Generating /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/reference/constant-values.html...
  [javadoc] Copying file StandardDocFile[file:/Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/resources/stylesheet.css] to file stylesheet.css...
  [javadoc] Building index for all the packages and classes...
  [javadoc] Building index for all classes...
  [javadoc] Generating /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/reference/help-doc.html...
  [javadoc] Note: Custom tags that could override future standard tags:  <a href="/two/profile/example">@example</a>. To avoid potential overrides, use at least one period character (.) in custom tag names.
  [javadoc] 3 warnings
generate.libprops:
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC
parse.file:
     [echo] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp/JSONRPC/library.properties
copyToSketchbook:
     [echo] copying files to the libraries folder in your sketchbook.
   [delete] Deleting directory /Applications/Processing/libraries/JSONRPC
    [mkdir] Created dir: /Applications/Processing/libraries/JSONRPC
     [copy] Copying 19 files to /Applications/Processing/libraries/JSONRPC
generate.distribution:
   [delete] Deleting directory /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/JSONRPC
     [move] Moving 19 files to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1
generate.install.library:
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1
parse.file:
     [echo] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/README.md
generate.web:
    [mkdir] Created dir: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web
     [copy] Copying 15 files to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/reference
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/examples
     [copy] Copying 2 files to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web
parse.file:
     [echo] /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/index.html
processExamples:
addExamples:
     [echo] Hello
generate.zip:
     [move] Moving 19 files to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/tmp/JSONRPC
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/download
      [zip] Building zip: /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/JSONRPC.zip
     [move] Moving 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/download
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/download
     [copy] Copying 1 file to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/web/download
     [move] Moving 22 files to /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1
   [delete] Deleting directory /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/distribution/JSONRPC-1/tmp
   [delete] Deleting directory /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/tmp
clean:
   [delete] Deleting directory /Users/Reenforcements/Documents/BeginningJava/Eclipse/JSONRPC/processing-library-template-3.0.1/bin
     [echo]         
     [echo] ------------------------------------------------------------------------------------------------
     [echo] Name        JSONRPC 
     [echo] Version     1.0.0 (1)
     [echo] Compiled    normal
     [echo] Sketchbook  /Applications/Processing
     [echo] ------------------------------------------------------------------------------------------------
     [echo] done, finished.
     [echo] ------------------------------------------------------------------------------------------------
     [echo]         
BUILD SUCCESSFUL
Total time: 3 seconds
</code></pre>
]]></description>
   </item>
   <item>
      <title>is there any way to make the serial port on the raspberry pi operate at 250kbits</title>
      <link>https://forum.processing.org/two/discussion/15817/is-there-any-way-to-make-the-serial-port-on-the-raspberry-pi-operate-at-250kbits</link>
      <pubDate>Sat, 02 Apr 2016 19:44:36 +0000</pubDate>
      <dc:creator>michaelkpierce</dc:creator>
      <guid isPermaLink="false">15817@/two/discussions</guid>
      <description><![CDATA[<p>I would like to have the Pi be controlled from DMX commands and need to receive at 250kbits for DMX.  I have messed around with setting the baud rate and even changing the baud clock initialization in the config.txt file without much luck.  Doesn't look like I can get it much faster than 38kbps</p>

<p>Appreciate any ideas.</p>
]]></description>
   </item>
   <item>
      <title>Difference in framerate between USB serial com port and bluetooth?</title>
      <link>https://forum.processing.org/two/discussion/14513/difference-in-framerate-between-usb-serial-com-port-and-bluetooth</link>
      <pubDate>Sun, 17 Jan 2016 22:12:50 +0000</pubDate>
      <dc:creator>douggannon1</dc:creator>
      <guid isPermaLink="false">14513@/two/discussions</guid>
      <description><![CDATA[<p>Why would there be a difference in framerate speed when using the USB serial port versus using a JY_MCU Bluetooth serial device?</p>

<p>Here is part of my code:</p>

<pre><code>String portName = Serial.list()[0]; //element 0 typically is my Bluetooth device, 2 is my USB serial port
myPort = new Serial(this, portName, 9600);
frameRate(100);
</code></pre>

<p>I am using the following to actually send data to my Arduino either on USB serial or Bluetooth serial:</p>

<pre><code>myPort.write(pwmOutArray[pwmWriteIndex]);
</code></pre>

<p>When I run this with my USB serial com port, I get a framerate of about 100. However, when I run this same code using the Bluetooth serial device, the framerate is much slower: typically 20-35 frames per second, so the Bluetooth slows down code execution.</p>

<p>Can anyone explain this?<br />
Thanks for your help.</p>
]]></description>
   </item>
   <item>
      <title>Plug &amp; play serial communication</title>
      <link>https://forum.processing.org/two/discussion/14126/plug-play-serial-communication</link>
      <pubDate>Wed, 23 Dec 2015 14:21:24 +0000</pubDate>
      <dc:creator>rjth</dc:creator>
      <guid isPermaLink="false">14126@/two/discussions</guid>
      <description><![CDATA[<p>For my upcoming project I created a class for “plug &amp; play” serial communication between Processing and Arduino or other serial devices. The device is instantly recognised when plugged into the computer and the communication is established on the detected address. This way the application can be used universally on different computers and platforms, eliminating the need to manually type out the serial port addresses.</p>

<p><strong><a rel="nofollow" href="https://github.com/rjth/autoserialp5">autoserialp5 repository</a></strong></p>
]]></description>
   </item>
   <item>
      <title>Connect to a nrf51 microcontroller using Bluetooth Low Energy (v4.0) using Processing?</title>
      <link>https://forum.processing.org/two/discussion/11445/connect-to-a-nrf51-microcontroller-using-bluetooth-low-energy-v4-0-using-processing</link>
      <pubDate>Wed, 24 Jun 2015 19:34:30 +0000</pubDate>
      <dc:creator>neilscarv</dc:creator>
      <guid isPermaLink="false">11445@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I have a nordic nrf51dk board which has a GATT service to send some heart rate data which  uses bluetooth low energy -Bluetooth Smart. I wanted to receive it on the Desktop using Processing. Could you please help me with libraries with it.</p>

<p>Many Thanks and Regards,
Neil</p>
]]></description>
   </item>
   <item>
      <title>Connect to specific com port on serial</title>
      <link>https://forum.processing.org/two/discussion/10940/connect-to-specific-com-port-on-serial</link>
      <pubDate>Thu, 21 May 2015 17:49:07 +0000</pubDate>
      <dc:creator>mori3rti</dc:creator>
      <guid isPermaLink="false">10940@/two/discussions</guid>
      <description><![CDATA[<p>hello, I'm new in processing. before I explain the problem, apologize for my bad english.</p>

<p>so I have a project using Raspbery Pi and connected to the robot (arduino) via bluetooth. serial port used is / dev / rfcomm0. I want RPI response "Turn On The Robot" when the robot does not live . I tried using Serial.list (), store it in a String and then compare it, it did not succeed. I'm new in programming java.</p>

<p>i really need help to solve this.</p>

<pre>

import processing.serial.*;

char[] data_ = new char[10];
String serial_port;
String save_port;
String serialRfcomm = "/dev/rfcommO";
int WIDTH   = 800; //x
int HEIGHT  = 470; //y
int tunjuk = 0;
PFont font;
Serial BT;
char x;
boolean btCheck = false;

void setup() {

  size(400, 240);
  smooth();
  font = loadFont("~/App/data/AgencyFB-Reg-48.vlw");

  textFont(font, 14);
  serial_port = BT.list()[0];
  BT = new Serial(this, serial_port, 9600);
}

void draw() {
  background(0);

  serial_port = BT.list()[0];         // store serial port
  if ( serial_port == serialRfcomm) { // compare to take action 
    if (!btCheck) {
      BT = new Serial(this, serial_port, 9600);
      btCheck = true;
    }
    textSize(14);
    text("robot Is ON", 10, 10);
    println("robot Is ON");
  } else {                              // if not print it
    println(serial_port);
    println("Turn ON robot");
    text("Turn ON Robot", 10, 10);
  }

 
}

</pre>
]]></description>
   </item>
   <item>
      <title>Is there any way to send data through a USB connection with Processing?</title>
      <link>https://forum.processing.org/two/discussion/10542/is-there-any-way-to-send-data-through-a-usb-connection-with-processing</link>
      <pubDate>Mon, 27 Apr 2015 18:36:39 +0000</pubDate>
      <dc:creator>anthony20</dc:creator>
      <guid isPermaLink="false">10542@/two/discussions</guid>
      <description><![CDATA[<p>Hello, good afternoon:</p>

<p>I have a problem with a thermal printer drivers, samsung BIXOLON SPR 350 II.</p>

<p>The main problem is that the printer is recognized as usb port. 
I would turn that USB port to COM to use the processing.serial library.
But I've tried to change and is not possible.</p>

<p><strong>Is there a way to send a string of data through the USB port using processing?</strong></p>

<p>Other solutions I have tried without success and who may be possible:
-Mandar From app to windows, a print order, a .txt document.
Maybe send a sequence of commands with MS-2 file path.</p>

<p>Print document from java, I tried several stackoverflow codes but give me error.</p>

<p>thanks</p>
]]></description>
   </item>
   <item>
      <title>New file for serial data on button toggle?</title>
      <link>https://forum.processing.org/two/discussion/10481/new-file-for-serial-data-on-button-toggle</link>
      <pubDate>Thu, 23 Apr 2015 22:12:24 +0000</pubDate>
      <dc:creator>frostygoat</dc:creator>
      <guid isPermaLink="false">10481@/two/discussions</guid>
      <description><![CDATA[<p>I had an earlier question on this but it wasn't very clear and I hadn't done enough homework.</p>

<p>I'm viewing serial data from Arduino (it will be plotted but isn't here to make the example simpler). I only want to record when something interesting is happening. Record is triggered with a mouse click on a button from Processing.  The following code works great. BUT, I can only record one snippet of the data stream.</p>

<pre><code>import processing.serial.*; 

Serial myPort;    // The serial port
int mills; 
String dataOutput;
int val;
int value;
PrintWriter output;

int rectX = 50; //button coords
int rectY = 400;
int rectW = 100;
int rectH = 50;
String command = "";
boolean canStart = true;
String timestamp;

void setup() { 
  size(1500, 480);
  println(Serial.list()); 
  myPort = new Serial(this, Serial.list()[2], 9600); 
  //output = createWriter("test.txt");
  //myPort.bufferUntil(lf); 
  //output = createWriter(timestamp + ".txt");
  timestamp = year() + nf(month(),2) + nf(day(),2) + "-"  + nf(hour(),2) + nf(minute(),2)+ nf(second(),2);
  output = createWriter(timestamp + ".txt");
} 
int getValue() {
  int value = -1;
  while (myPort.available () &gt;= 3) {
    if (myPort.read() == 0xff) {
      value = (myPort.read() &lt;&lt; 8) | (myPort.read());
    }
  }
  return value;
}
void draw() {
  background(0);

  if (canStart) {
    command = "REC";
    fill(0, 255, 0);
  } else {
    saveData();
    command = "STOP";
    fill(255, 0, 0);
  }
  noStroke();
  rect(rectX, rectY, rectW, rectH);
  fill(255);
  text(command, rectX + 30, rectY + 30);  
 }

void mousePressed() {
    if(buttonOver()){
   if(canStart){
    } else {
    output.flush(); // Writes the remaining data to the file
    output.close(); // Finishes the file
    PrintWriter output;
    }
     canStart = !canStart;
  }
}

boolean buttonOver()  {
  if (mouseX &gt;= rectX &amp;&amp; mouseX &lt;= rectX+rectW &amp;&amp; 
      mouseY &gt;= rectY &amp;&amp; mouseY &lt;= rectY+rectH) {
    return true;
  } else {
    return false;
  }
}

void saveData(){
  val = getValue();
  mills= millis();
  String[] dataOutput = {val + "," + mills};
  println(dataOutput); 
  output.println(val + "," + mills); // Write the coordinate to the file 
}
</code></pre>

<p>I really need a new createWriter to make a new file each time the button is pressed. So I tried the following:</p>

<pre><code>void saveData(){
  timestamp = year() + nf(month(),2) + nf(day(),2) + "-"  + nf(hour(),2) + nf(minute(),2)+ nf(second(),2);
  output = createWriter(timestamp + ".txt");
  val = getValue();
  mills= millis();
  String[] dataOutput = {val + "," + mills};
  println(dataOutput); 
  output.println(val + "," + mills); // Write the coordinate to the file 
}
</code></pre>

<p>This continually creates empty files, and doesn't get me where I want to be.</p>
]]></description>
   </item>
   <item>
      <title>problens when try close firmata connection</title>
      <link>https://forum.processing.org/two/discussion/10332/problens-when-try-close-firmata-connection</link>
      <pubDate>Wed, 15 Apr 2015 12:13:20 +0000</pubDate>
      <dc:creator>AlvaroPFN</dc:creator>
      <guid isPermaLink="false">10332@/two/discussions</guid>
      <description><![CDATA[<p>i am trying make a aplication capable of change between different arduino boards. But before a start  a new connection i must close the previous one and i can't find correct whay to do this.</p>

<p>this is my code to connect:</p>

<pre><code>public boolean tentarInstancia(String serial)
{
    try
    {
        //it's work with regular serial communication, but don't work with firmata
        arduino.stop();
    }

    catch (Exception e){println(e.getMessage());}

    finally{this.conectado = false;}

    try
    {
        arduino = new Arduino(dad, serial, 57600);

        delay(2000);

        try
        {
            definirModosPortas();   
        }
        catch (Exception e) {println(e.getMessage());}

        println("conexao com: " + serial + " bem sucedida");
        this.conectado = true;      
    }

    catch (Exception e){println(e.getMessage());}

    finally
    {
        if(conectado) this.COM = serial;
        else this.COM = "null";
        return this.conectado;
    }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Serial Communication error on serialEvent()</title>
      <link>https://forum.processing.org/two/discussion/9539/serial-communication-error-on-serialevent</link>
      <pubDate>Sun, 22 Feb 2015 20:31:01 +0000</pubDate>
      <dc:creator>leowu4ever</dc:creator>
      <guid isPermaLink="false">9539@/two/discussions</guid>
      <description><![CDATA[<p>I am working on serial communication with the example code. However, i am getting an error says 
(Error, disabling serialEvent() for /dev/tty.usbmodem1421
null)</p>

<p>I am using mac the ports printed out are following 
[0] "/dev/cu.Bluetooth-Incoming-Port"
[1] "/dev/cu.Bluetooth-Modem"
[2] "/dev/cu.leosiPhone-WirelessiAP"
[3] "/dev/cu.usbmodem1421"
[4] "/dev/tty.Bluetooth-Incoming-Port"
[5] "/dev/tty.Bluetooth-Modem"
[6] "/dev/tty.leosiPhone-WirelessiAP"
[7] "/dev/tty.usbmodem1421"</p>

<p>I have been testing with [3] and [7] but neither worked.</p>

<p>Here is the code for Arduino and Processing 
<a href="http://paste.ofcode.org/37ECjBku7ng9qTqbTP4Y9Ut" target="_blank" rel="nofollow">http://paste.ofcode.org/37ECjBku7ng9qTqbTP4Y9Ut</a>
<a href="http://paste.ofcode.org/R3XRrWgTJ7kMnXJ9PbtXPE" target="_blank" rel="nofollow">http://paste.ofcode.org/R3XRrWgTJ7kMnXJ9PbtXPE</a></p>

<p>Can somebody please tell me what goes wrong ?</p>
]]></description>
   </item>
   <item>
      <title>[SOLVED] Error, disabling serialEvent() for COM3</title>
      <link>https://forum.processing.org/two/discussion/9395/solved-error-disabling-serialevent-for-com3</link>
      <pubDate>Thu, 12 Feb 2015 15:11:42 +0000</pubDate>
      <dc:creator>rossdickinson</dc:creator>
      <guid isPermaLink="false">9395@/two/discussions</guid>
      <description><![CDATA[<p>Hey, I'm using Arduino to gather a string of data which looks like this in the serial monitor of Arduino:</p>

<pre><code>200,0,0,79188,259228,102427,41468,112985,135554,35911,182789

200,0,0,1240804,785300,292349,440138,262836,288606,132864,693346

200,0,0,1237910,1015913,144220,750405,60550,144449,133690,754115
</code></pre>

<p>I'm wanting to take this into Processing and split the strings so i can access a certain column from the data. The code I have at the moment is running the error in the discussion title every time I try to run it though. I've tried to solve the problem but with no luck, so I think there must be an error in my code somewhere in the serial event maybe?</p>

<p>I will post the code below, thanks for taking a look!</p>

<pre><code>import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

void setup () {
  // set the window size:
  size(400, 300);     

  // List all the available serial ports
  println(Serial.list());

  myPort = new Serial(this, Serial.list()[0], 9600);
  // don't generate a serialEvent() unless you get a newline character:
  myPort.bufferUntil('\n');
  // set inital background:
  background(0);
}
void draw () {
  // everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');
  int[] list = int(splitTokens(inString, ","));

  if (inString != null) {
    // trim off any whitespace:
    println( "Recieving:" + inString);
    inString = trim(inString);
    // convert to an int and map to the screen height:
    float inByte = float(list[4]);
    inByte = map(inByte, 0, 1023, 0, height);

    // draw the line:
    stroke(127, 34, 255);
    line(xPos, height, xPos, height - inByte);

    // at the edge of the screen, go back to the beginning:
    if (xPos &gt;= width) {
      xPos = 0;
      background(0);
    } else {
      // increment the horizontal position:
      xPos++;
    }
  }
}
</code></pre>

<p>UPDATE: I think this error code was just a bug cause it fixed once I restarted processing + my computer</p>
]]></description>
   </item>
   <item>
      <title>How to label received data and frames of recorded video?</title>
      <link>https://forum.processing.org/two/discussion/9246/how-to-label-received-data-and-frames-of-recorded-video</link>
      <pubDate>Sat, 31 Jan 2015 12:33:47 +0000</pubDate>
      <dc:creator>oilpig</dc:creator>
      <guid isPermaLink="false">9246@/two/discussions</guid>
      <description><![CDATA[<p>hey, I am a new bird of Processing. I want to write a program to record a video efficiently as well as receive data through serial port.</p>

<p>Is there a reliable and efficient way to label the received data and the captured image? Because the received data will then be  processed according to the corresponding captured image.</p>

<p>Can I save the image followed by saving received data within the big loop ? I am worried that it would be too slow to capture enough information in time.</p>
]]></description>
   </item>
   <item>
      <title>Mistake when exporting a code usin video and serial library together</title>
      <link>https://forum.processing.org/two/discussion/9148/mistake-when-exporting-a-code-usin-video-and-serial-library-together</link>
      <pubDate>Fri, 23 Jan 2015 21:24:46 +0000</pubDate>
      <dc:creator>inge_gabs</dc:creator>
      <guid isPermaLink="false">9148@/two/discussions</guid>
      <description><![CDATA[<p>Hi!
I am making a remote control for a TV using serial comunication and a video. This code plays a video and names the serial ports. In fact it does, but when I export it to an aplication it crashes.</p>

<p>Thanks for the help. I am usin  windows 7 in a getaway 
Core i5</p>

<p>import processing.video.*;
import processing.serial.*;</p>

<p>Movie movie;
Serial myPort;  // Create object from Serial class
int val;</p>

<p>void setup() {
  size(640, 360);
  background(0);
  movie = new Movie(this, "Teclado.mp4");
  movie.loop();
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
  println(Serial.list());</p>

<p>}</p>

<p>void movieEvent(Movie m) {
  m.read();
}</p>

<p>void draw() {</p>

<p>image(movie, 0, 0, width, height);
}</p>
]]></description>
   </item>
   <item>
      <title>Problem whit Serial COM port declaration!</title>
      <link>https://forum.processing.org/two/discussion/9056/problem-whit-serial-com-port-declaration</link>
      <pubDate>Thu, 15 Jan 2015 14:26:13 +0000</pubDate>
      <dc:creator>Loraxen</dc:creator>
      <guid isPermaLink="false">9056@/two/discussions</guid>
      <description><![CDATA[<p>Hi to everybody , my name is Lorenzo, i'm from Rome, Italy.
Sorry for bad english!
I have a problem whit the serial library, i use it to comunicate whit arduino, but when i load some sketchs on processing IDE
, it say an error: "Array Index Out Of Bounds exception" an the IDE underline this line:   String portName = Serial.list()[0];
What can i do? i have try to load the serial examples like Simple read and write, i try to reinstall java , i use the 2.2.1 Processing IDE.
How can i do? Help me please...</p>
]]></description>
   </item>
   <item>
      <title>Serial Communication from Processing TO Arduino producing errors after some time</title>
      <link>https://forum.processing.org/two/discussion/8817/serial-communication-from-processing-to-arduino-producing-errors-after-some-time</link>
      <pubDate>Mon, 29 Dec 2014 05:55:26 +0000</pubDate>
      <dc:creator>Ron04317</dc:creator>
      <guid isPermaLink="false">8817@/two/discussions</guid>
      <description><![CDATA[<p>Hi Guys,</p>

<p>I am working on a drawing-machine, using processing for sending coordinates to my arduino due via serial.
Currently, I am having some trouble with the communication-part. I built my code basing largely on common tutorials for this kind of usage (serial communication from processing-&gt;arduino)</p>

<p>The code I got so far for both sides is basicallys doing what I want, BUT:</p>

<p><strong>After a certain point, usually around the 12th coordinate beeing send from processing to arduino,
the recieved values start to have errors and then the whole communication seems to get out of sync.</strong></p>

<p><strong>The fact, that the code works at the beginning but fails after some repetitions gives me the impression,
that the error must lie in some kind of data overflow. (mabye some kind of buffer at the arduino?)</strong>
Unfortunately, I do not know enough about the details of serial-communication to figure that one out for myself.</p>

<p><strong>Maybe you guys could help me?</strong></p>

<p>My questions would be:</p>

<p><strong>-</strong>is there some kind of input-buffer that would need to be cleared to prevent it from overflowing?</p>

<p><strong>-</strong>is the handshake-communication-method done the right way in my code?</p>

<p><strong>-</strong>what other reasons could there be for this kind of errors by time?</p>

<p>A little help here would be awesome.
If you find something awfully stupid in my code, I am also happy to get hints of course,
always eager to learn something ;)</p>

<p>Thank you all!</p>

<p>You find my code here:</p>

<p>(FYI: as you will see, the current processing-code sends a set of 15 x/y-coordinates in a loop-&gt; thats the placeholder for the actual coordinate-routine, which is working and therefore of no concern here)</p>

<p>Processing-Code</p>

<pre><code> import processing.serial.*; //import the Serial library

 Serial myPort;  //the Serial port object
 String val;

boolean firstContact = false; // since we're doing serial handshaking, 
                              // we need to check if we've heard from the microcontroller

int dataX[]={10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150};
int dataY[]={15, 25, 35, 45, 55, 65, 75 ,85 , 95, 105, 115, 125, 135, 145, 155};



void setup()
{
  size(500, 500); //make our canvas 200 x 200 pixels big
  myPort = new Serial(this, Serial.list()[1], 9600); //  initialize your serial port and set the baud rate to 9600
  delay(2000);
  myPort.bufferUntil('\n'); //This let’s us store the incoming data into a buffer, until we see a specific character we’re looking for.
}

void draw()
{
  //we can leave the draw method empty, 
  //because all our programming happens in the serialEvent (see below)
}

void serialEvent( Serial myPort)
{
  val = myPort.readStringUntil('\n');    //put the incoming data into a String - the '\n' is our end delimiter indicating the end of a complete packet
  if (val != null)    //make sure our data isn't empty before continuing
  {
    val = trim(val);    //trim whitespace and formatting characters (like carriage return)
    println(val);
    if (firstContact == false)
    {
      if (val.equals("A"))  //look for our 'A' string to start the handshake, 
      {
        myPort.clear();     //if it's there, clear the buffer, and send a request for data
        firstContact = true;
        myPort.write("A");
        println("contact");
       }
    }
    else
    { //if we've already established contact, keep getting and parsing data
      println(val);
      for(int i= 0;i&lt;=14;i++)
      {
        myPort.write("B");  
        myPort.write("X");
        myPort.write(dataX[i]);
        delay(10);
        myPort.write("Y");
        myPort.write(dataY[i]);
        delay(10);
      }
    }
    myPort.write("A");// when you've parsed the data you have, ask for more:
 }
}
</code></pre>

<p>Arduino-Code</p>

<pre lang="c">
    char val; // Data received from the serial port
    int ledPin = 13; // Set the pin to digital I/O 13
    boolean ledState = LOW; //to toggle our LED
    
    int newX;
    int newY;
    
    int counter = 0;
    
    void setup() 
    {
      pinMode(ledPin, OUTPUT); // Set pin as OUTPUT
      //initialize serial communications at a 9600 baud rate
      Serial.begin(9600);
      establishContact();  // send a byte to establish contact until receiver responds 
    }
    
    void loop()
    {
      if (Serial.available() &gt; 0) // If data is available to read,
      { 
        val = Serial.read(); // read it and store it in val
        if(val == 'B') //if we get a B
        {
          val = Serial.read();
          if(val == 'X')
          {
            newX = Serial.read();
            Serial.println("New X = ");
            Serial.println(newX);
          }
          val = Serial.read();
          if(val == 'Y')
          {
            newY = Serial.read();
            Serial.println("New Y = ");
            Serial.println(newY);
          }
          Serial.print("counter = ");
          Serial.println(counter);
          Serial.println("moving .......");
          counter++;
          
          delay(300);
                       
        }
       } 
      else
      {
        Serial.println("Arduino Waiting for Input!"); //send back a hello world
        delay(50);
      }
    }
</pre>

<pre><code>void establishContact()
{
  while (Serial.available() &lt;= 0)
  {
  Serial.println("A");   // send a capital A
  delay(300);
  }
}
</code></pre>

<p></p>

<p><em>(the last two code parts belong together, the code-formatting chopped of the last bit, don't know why)</em></p>
]]></description>
   </item>
   <item>
      <title>Problem with serial baudrate</title>
      <link>https://forum.processing.org/two/discussion/8667/problem-with-serial-baudrate</link>
      <pubDate>Mon, 15 Dec 2014 08:13:32 +0000</pubDate>
      <dc:creator>progloverfan</dc:creator>
      <guid isPermaLink="false">8667@/two/discussions</guid>
      <description><![CDATA[<p>Hi.
When compiling some code specifying serial baudrate of 921600 I have problems because it seems that the port work's on another speed.
When using processing 2.0 in another computer I have no problems (by that time you used RXTX serial library), but when exporting that code to another computer and installing processing 2.2.1 or 3.0a5 I have problems communicating with serial port. --
Is strange because I wasn't be able to communicate properly with a remote device with the serial com even with the exported application. And when using the code for debugging I discover that the remote device respond before than writing all the payload so I assume that there is a problem about the speed. I can't get the old processing because I can't find it anywhere, so how can I fix that?. Also I used other programs to communicate with that serial speed and no problem has appeared. It's seems that JSSC doesn't support that speed and RXTX does it, anyone was able to work at that speed?, how can I install RXTX?
Thanks</p>
]]></description>
   </item>
   <item>
      <title>Serial connection + working with strings</title>
      <link>https://forum.processing.org/two/discussion/8304/serial-connection-working-with-strings</link>
      <pubDate>Sun, 23 Nov 2014 09:39:51 +0000</pubDate>
      <dc:creator>strinda</dc:creator>
      <guid isPermaLink="false">8304@/two/discussions</guid>
      <description><![CDATA[<p>I want to get 5 numbers from Arduino
at the moment, the Arduino program looks like this</p>

<p>void setup() {
  Serial.begin(9600);
}</p>

<p>void loop() {
Serial.println ("45 56 56 65");
}</p>

<p>This is my Processing programm, and it doesn't work for some reason</p>

<p>import processing.serial.*;</p>

<p>int data [];</p>

<p>Serial myPort;
String val;</p>

<p>void setup () {
size (400,400);</p>

<p>String portName = Serial.list()[0];
myPort = new Serial (this, portName, 9600);
myPort.bufferUntil('\n');
}</p>

<p>void draw () {</p>

<p>}</p>

<p>void serialEvent (Serial myPort) 
{
val = myPort.readStringUntil('\n');
val = val.substring(0, val.indexOf("\n"));<br />
data = int(split(val, ' '));
}</p>

<p>Thank you for your help,
Alex</p>
]]></description>
   </item>
   <item>
      <title>Servo prelling under G4P</title>
      <link>https://forum.processing.org/two/discussion/8314/servo-prelling-under-g4p</link>
      <pubDate>Sun, 23 Nov 2014 17:08:29 +0000</pubDate>
      <dc:creator>domcsidd</dc:creator>
      <guid isPermaLink="false">8314@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone !
I made a GUI with GUI building tool, but i have some problems. My servos are prelling, and i don't know , where is the problem O.o. Can anybody help ?</p>

<p>arduino code:
        #include &lt;Servo.h&gt;</p>

<pre><code>    Servo myservo1;              // create servo object to control a servo
    Servo myservo2;              // create servo object to control a servo
    Servo myservo3;              // create servo object to control a servo
    Servo myservo4;              // create servo object to control a servo


    void setup()
    {
      myservo1.attach(9);        
      myservo2.attach(10);
      myservo3.attach(11);
      myservo4.attach(3);
      Serial.begin(9600);       
    }

    void loop()
    {
      static int v = 0;
      if (Serial.available())  
      {
        char ch=Serial.read();
        switch(ch) 
        { 
        case '0'...'9': 
          v = v * 10 + ch - '0';
          break;
        case 'a':
          myservo1.write(v);
          v = 0;
          break;
        case 'b':
          myservo2.write(v);
          v = 0;
          break;
        case 'c':
          myservo3.write(v);
          v = 0;
          break;
        case 'd':
          myservo4.write(v);
          v = 0;
          break;
        }
      }

      delay(15);               
    }
</code></pre>

<p>processing code:</p>

<pre><code>import g4p_controls.*;
import processing.serial.*;

Serial port;        // create serial port object
int val;            // variable to receive data from the serial port
float mx = 0.0;
boolean firstTime = true;

int angle_Servo1;
int angle_Servo2;
int angle_Servo3;
int angle_Servo4;
int Servo1_direction;
int Servo2_direction;
int Servo3_direction;
int Servo4_direction;
public void setup() {
  size(900, 600, JAVA2D);
  noStroke();
  frameRate(10);
  println(Serial.list());
  port = new Serial(this, Serial.list()[0], 9600);
  createGUI();
  customGUI();
  // Place your setup code here
}

public void draw() {
  if (firstTime) {
    delay(3000);
    firstTime = false;
  }
  background(230);

  if (Servo1_direction==0) {
    port.write(angle_Servo1+"a");
  }
  if (Servo1_direction==1) {
    port.write((180-angle_Servo1)+"a");
  }
  if (Servo2_direction==0) {
    port.write(angle_Servo2+"b");
  }
  if (Servo2_direction==1) {
    port.write((180-angle_Servo2)+"b");
  }
  if (Servo3_direction==0) {
    port.write(angle_Servo3+"c");
  }
  if (Servo3_direction==1) {
    port.write((180-angle_Servo3)+"c");
  }
  if (Servo4_direction==0) {
    port.write(angle_Servo4+"d");
  }
  if (Servo4_direction==1) {
    port.write((180-angle_Servo4)+"d");
  }
}

// Use this method to add additional statements
// to customise the GUI controls
public void customGUI() {
}
</code></pre>

<p>g4p code:</p>

<pre><code>/* =========================================================
 * ====                   WARNING                        ===
 * =========================================================
 * The code in this tab has been generated from the GUI form
 * designer and care should be taken when editing this file.
 * Only add/edit code inside the event handlers i.e. only
 * use lines between the matching comment tags. e.g.

 void myBtnEvents(GButton button) { //_CODE_:button1:12356:
 // It is safe to enter your event code here  
 } //_CODE_:button1:12356:

 * Do not rename this tab!
 * =========================================================
 */

public void slider_Servo_1_change1(GCustomSlider source, GEvent event) { //_CODE_:slider_Servo_1:297470:
  angle_Servo1=slider_Servo_1.getValueI();
} //_CODE_:slider_Servo_1:297470:

public void slider_Servo_2_change1(GCustomSlider source, GEvent event) { //_CODE_:slider_Servo_2:794899:
  angle_Servo2=slider_Servo_2.getValueI();
} //_CODE_:slider_Servo_2:794899:

public void slider_Servo_3_change1(GCustomSlider source, GEvent event) { //_CODE_:slider_Servo_3:595541:
  angle_Servo3=slider_Servo_3.getValueI();
} //_CODE_:slider_Servo_3:595541:

public void slider_Servo_4_change1(GCustomSlider source, GEvent event) { //_CODE_:slider_Servo_4:797455:
  angle_Servo4=slider_Servo_4.getValueI();
} //_CODE_:slider_Servo_4:797455:

public void f_b_1way_click1(GDropList source, GEvent event) { //_CODE_:f_b_1way:691544:
  Servo1_direction=f_b_1way.getSelectedIndex();
} //_CODE_:f_b_1way:691544:

public void f_b_2way_click1(GDropList source, GEvent event) { //_CODE_:f_b_2way:449380:
  Servo2_direction=f_b_1way.getSelectedIndex();
} //_CODE_:f_b_2way:449380:

public void f_b_3way_click1(GDropList source, GEvent event) { //_CODE_:f_b_3way:685694:
  Servo3_direction=f_b_1way.getSelectedIndex();
} //_CODE_:f_b_3way:685694:

public void f_b_4way_click1(GDropList source, GEvent event) { //_CODE_:f_b_4way:449430:
  Servo4_direction=f_b_1way.getSelectedIndex();
} //_CODE_:f_b_4way:449430:



// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI() {
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setCursor(ARROW);
  if (frame != null)
    frame.setTitle("ServoControllv1.2");
  slider_Servo_1 = new GCustomSlider(this, 126, 18, 378, 54, "grey_blue");
  slider_Servo_1.setShowValue(true);
  slider_Servo_1.setShowLimits(true);
  slider_Servo_1.setLimits(0.0, 0.0, 180.0);
  slider_Servo_1.setNbrTicks(90);
  slider_Servo_1.setShowTicks(true);
  slider_Servo_1.setNumberFormat(G4P.DECIMAL, 0);
  slider_Servo_1.setOpaque(false);
  slider_Servo_1.addEventHandler(this, "slider_Servo_1_change1");
  lservo1label = new GLabel(this, 18, 18, 108, 54);
  lservo1label.setText("Servo: 1");
  lservo1label.setTextBold();
  lservo1label.setOpaque(false);
  lservo2label = new GLabel(this, 18, 72, 108, 54);
  lservo2label.setText("Servo: 2");
  lservo2label.setTextBold();
  lservo2label.setOpaque(false);
  slider_Servo_2 = new GCustomSlider(this, 126, 72, 378, 54, "grey_blue");
  slider_Servo_2.setShowValue(true);
  slider_Servo_2.setShowLimits(true);
  slider_Servo_2.setLimits(2.0, 1.0, 180.0);
  slider_Servo_2.setNbrTicks(90);
  slider_Servo_2.setShowTicks(true);
  slider_Servo_2.setNumberFormat(G4P.DECIMAL, 0);
  slider_Servo_2.setOpaque(false);
  slider_Servo_2.addEventHandler(this, "slider_Servo_2_change1");
  lservo3label = new GLabel(this, 18, 126, 108, 54);
  lservo3label.setText("Servo: 3");
  lservo3label.setTextBold();
  lservo3label.setOpaque(false);
  slider_Servo_3 = new GCustomSlider(this, 126, 126, 378, 54, "grey_blue");
  slider_Servo_3.setShowValue(true);
  slider_Servo_3.setShowLimits(true);
  slider_Servo_3.setLimits(0.0, 0.0, 180.0);
  slider_Servo_3.setNbrTicks(90);
  slider_Servo_3.setShowTicks(true);
  slider_Servo_3.setNumberFormat(G4P.DECIMAL, 0);
  slider_Servo_3.setOpaque(false);
  slider_Servo_3.addEventHandler(this, "slider_Servo_3_change1");
  f_b_1way = new GDropList(this, 504, 18, 126, 162, 2);
  f_b_1way.setItems(loadStrings("list_691544"), 1);
  f_b_1way.addEventHandler(this, "f_b_1way_click1");
  f_b_2way = new GDropList(this, 504, 72, 126, 162, 2);
  f_b_2way.setItems(loadStrings("list_449380"), 1);
  f_b_2way.addEventHandler(this, "f_b_2way_click1");
  f_b_3way = new GDropList(this, 504, 126, 126, 162, 2);
  f_b_3way.setItems(loadStrings("list_685694"), 1);
  f_b_3way.addEventHandler(this, "f_b_3way_click1");
  lservo4label = new GLabel(this, 18, 180, 108, 54);
  lservo4label.setText("Servo: 4 ");
  lservo4label.setTextBold();
  lservo4label.setOpaque(false);
  slider_Servo_4 = new GCustomSlider(this, 126, 180, 378, 54, "grey_blue");
  slider_Servo_4.setShowValue(true);
  slider_Servo_4.setShowLimits(true);
  slider_Servo_4.setLimits(0.0, 0.0, 180.0);
  slider_Servo_4.setNbrTicks(90);
  slider_Servo_4.setShowTicks(true);
  slider_Servo_4.setNumberFormat(G4P.DECIMAL, 0);
  slider_Servo_4.setOpaque(false);
  slider_Servo_4.addEventHandler(this, "slider_Servo_4_change1");
  f_b_4way = new GDropList(this, 504, 180, 126, 162, 2);
  f_b_4way.setItems(loadStrings("list_449430"), 1);
  f_b_4way.addEventHandler(this, "f_b_4way_click1");
}

// Variable declarations 
// autogenerated do not edit
GCustomSlider slider_Servo_1; 
GLabel lservo1label; 
GLabel lservo2label; 
GCustomSlider slider_Servo_2; 
GLabel lservo3label; 
GCustomSlider slider_Servo_3; 
GDropList f_b_1way; 
GDropList f_b_2way; 
GDropList f_b_3way; 
GLabel lservo4label; 
GCustomSlider slider_Servo_4; 
GDropList f_b_4way; 
</code></pre>

<p>Sorry for pasting the whole code , but i new in processing, and i learn by myself . I really don't know what the matter is . Thanks for help :)</p>
]]></description>
   </item>
   <item>
      <title>setDTR not doing anything</title>
      <link>https://forum.processing.org/two/discussion/7380/setdtr-not-doing-anything</link>
      <pubDate>Mon, 29 Sep 2014 09:10:55 +0000</pubDate>
      <dc:creator>Portos</dc:creator>
      <guid isPermaLink="false">7380@/two/discussions</guid>
      <description><![CDATA[<p>I've been using processing 2.2.1 to try to get some serial communication going. The serial javadoc no longer exists so it's a bit hard stumbling in the dark but I managed until now.</p>

<p>I need to control the DTR pin to keep it HIGH but the setDTR command is doing nothing at all.</p>

<pre><code>import processing.serial.*; 

Serial myPort;    // The serial port


void setup() { 
  size(400,200); 
  println(Serial.list()); 
  myPort = new Serial(this, "COM9", 115200); 
  myPort.setDTR(true);



} 

void draw ()
{

}
</code></pre>

<p>This is just supposed to open the port and set the DTR pin to HIGH... but it doesn't do that. I put my oscope on the board and the DTR pin is LOW.</p>

<p>Am I doing something wrong in assuming setDTR will do this?</p>
]]></description>
   </item>
   <item>
      <title>if statement based on serial string</title>
      <link>https://forum.processing.org/two/discussion/7295/if-statement-based-on-serial-string</link>
      <pubDate>Tue, 23 Sep 2014 01:53:08 +0000</pubDate>
      <dc:creator>alexs</dc:creator>
      <guid isPermaLink="false">7295@/two/discussions</guid>
      <description><![CDATA[<p>I have an Arduino sending serial.print data whenever a button is used.  The strings are things such as "3High", "3Low", "4High", "4Low", etc...</p>

<p>I want to use a series of if statements to trigger events via processing.  For example, when "3High" is read, something will happen.  When a combination are pressed (eg, "3Low" + "4Low") something else will happen.</p>

<p>I'm struggling with the syntax of the if statement...</p>

<p>Here's some code I'm experimenting with, an ellipse should appear when switch 3 is pressed:</p>

<p>import processing.serial.*;</p>

<pre><code>Serial myPort;  // Create object from Serial class
String val;     // Data received from the serial port

void setup() 
{
// Open whatever port is the one you're using.
String portName = Serial.list()[1]; //change the 0 to a 1 or 2 etc. to match your port
myPort = new Serial(this, portName, 9600); 
}

void draw()
{
  if ( myPort.available() &gt; 0) 
  {  // If data is available,
  val = myPort.readStringUntil('\n');         // read it and store it in val
  } 
println(val); //print it out in the console

  if (val == "3Low"){
    ellipse(50, 50, 100, 100);
  }

  //DRAW RECTANGLE (that changes on different switch states)
  background(200);

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>pls help to find what's wrong with my code</title>
      <link>https://forum.processing.org/two/discussion/7065/pls-help-to-find-what-s-wrong-with-my-code</link>
      <pubDate>Sun, 07 Sep 2014 12:28:15 +0000</pubDate>
      <dc:creator>zhanglq</dc:creator>
      <guid isPermaLink="false">7065@/two/discussions</guid>
      <description><![CDATA[<p>I wrote a piece of code to read serial data (hex) and turns the data to dec for future usage, the code is as follows. But there's something wrong with the line: brightness=unhex(brightnessHEX). I have no idea about it and really hope somebosy here to help me with that.</p>

<pre><code>import processing.serial.*;
Serial myPort;
int brightness = 0;
PFont font;
String brightnessHEX;

void setup() {
  size(800, 600);
  smooth();

  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
  myPort.bufferUntil('\n');
}

void draw() {
  background(0);

  while (myPort.available () &gt; 0) {
    brightnessHEX = myPort.readStringUntil('\n');
    if (brightnessHEX != null) {
      println(brightnessHEX);
      brightness=unhex(brightnessHEX);
      println(brightness);
    }
  }
  ......
}
</code></pre>

<p><img src="http://forum.processing.org/two/uploads/imageupload/377/IEYPYVO28U6E.JPG" alt="scapture001" title="scapture001" /></p>
]]></description>
   </item>
   </channel>
</rss>