<?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 equals() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=equals%28%29</link>
      <pubDate>Sun, 08 Aug 2021 16:22:02 +0000</pubDate>
         <description>Tagged with equals() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedequals%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Implementing a Free 3D Camera</title>
      <link>https://forum.processing.org/two/discussion/26444/implementing-a-free-3d-camera</link>
      <pubDate>Tue, 20 Feb 2018 03:57:08 +0000</pubDate>
      <dc:creator>vjjv</dc:creator>
      <guid isPermaLink="false">26444@/two/discussions</guid>
      <description><![CDATA[<p>Hello! in this occasion i`ve a difficult to implement a mouse3D spaceNavigator as a free Camera (like the viewer example from the spaceNavigator software or any other example for this type of camera). when i worked with peasyCam, the lookAt vector was for default the center of the scene. In the spaceNavigator viewer the target was upload (and displayed with a little box) according the camera "navigates". This is what i was trying to do, use the spaceNavigator to navigate the 3D world moving the camera around the 3d shapes. Nevertheless, im a little bit lost and i don't know exactly how calculates the coordinates and the transformations for the camera. this is only the Camera-Player class with the spaceNavigator inputs (post only the class assuming that not everybody has a spaceNavigator) in the comments the description of the spaceNavigator manual for everyValue. Also, Every value is from negative 0.538 to positive 0.538 mapping as left-right, up-down, in-out, etc; I really appreciate some kind of help. Thank you very much</p>

<pre><code>class Player {
  PVector pos;
  PVector lookAt;
  PVector up;

  PApplet parent;

  Player(PApplet p) {

    pos = new PVector(0, 0, 0);
    lookAt = new PVector(0, 0, -100);
    up = new PVector(0, 1, 0);
  }

  void update() {
    beginCamera();
    float xx = (Float)spaceNavigator.get("x");     // Right/Left: Moves (pan) the model or document right and left
    float yy = (Float)spaceNavigator.get("y");     // Up/Down: Moves (pan) the model or document up and down
    float zz = (Float)spaceNavigator.get("z");    // In/Out: Zoom the model or document in and out
    float rx = (Float)spaceNavigator.get("rx");   // Tilt: Tilts the model or scene forwards and backwards
    float ry = (Float)spaceNavigator.get("ry");   // Spin:   Spins the model or scene like a top
    float rz = (Float)spaceNavigator.get("rz");  // Roll:   Rolls the model or scene sideways

    float b0 = (Float)spaceNavigator.get("b0");  //button
    float b1 = (Float)spaceNavigator.get("b1");  //button


    camera(pos.x, pos.y, pos.z, lookAt.x, lookAt.y, lookAt.z, up.x, up.y, up.z);
    endCamera();
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Im trying to make a program that checks for Palindromes</title>
      <link>https://forum.processing.org/two/discussion/27812/im-trying-to-make-a-program-that-checks-for-palindromes</link>
      <pubDate>Sat, 21 Apr 2018 02:12:29 +0000</pubDate>
      <dc:creator>theyodaperson22</dc:creator>
      <guid isPermaLink="false">27812@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone, I just recently got into processing and have a question about how to write a palindrome checker for my analyzer class. Here is the code I have so far but always says palindromes are not palindromes.</p>

<p>Some notes, wordList is the input in the main class
using processing 3. The method I am trying to use is comparing the reversed version of the string with itself to see if they are the same. Hope you can help, thanks!</p>

<p><code>Boolean isPalindrome(String wordList)
{
  String a;
 a="";
 for(int i=0; i&lt;wordList.length();i++)
 {
  a = a + wordList.charAt(wordList.length()-1-i); 
 }
   if(a == wordList)
   {
     println();
     print("Its a palindrome");
     fill(0);
 textSize(14);
  text("Its a palindrome",80,170);
    return true;
   }
  else
  {
    println();
    print("Its not a palindrome");
    fill(0);
 textSize(14);
 text("Its not a palindrome",80,170);
    return false;
  }</code></p>
]]></description>
   </item>
   <item>
      <title>HashMap float by reference, not by value?</title>
      <link>https://forum.processing.org/two/discussion/27710/hashmap-float-by-reference-not-by-value</link>
      <pubDate>Sat, 07 Apr 2018 05:11:50 +0000</pubDate>
      <dc:creator>lmccandless</dc:creator>
      <guid isPermaLink="false">27710@/two/discussions</guid>
      <description><![CDATA[<p>Everything I find online, stackoverflow, says a HashMap&lt;String, Float&gt;(); should store only references to the floats.</p>

<p>When I store something in the hashmap, use hashmap.get() to get the float object, I can't seem to write to the original object.
In this example I try to get and modify the original float1 variable without success. It seems to modify a new float stored in the hashmap in test2, test1 does nothing.</p>

<pre><code>Float float1 = 1.1;
HashMap&lt;String, Float&gt; hm = new HashMap&lt;String, Float&gt;();

void setup() {
  hm.put("float1", float1);

  Float f1 = hm.get("float1");
  f1 = 5.5;

  println("test1");
  println("float1: " + float1);
  println("hashMap float1: " + hm.get("float1"));
  println("both should  should be " + f1);
  println();

  println("test2");
  hm.put("float1", f1);
  println("float1: " + float1);
  println("hashMap float1: " + hm.get("float1"));
  println("both should  should be " + f1);
  println();
}
</code></pre>

<p>Here's the output</p>

<pre><code>test1
float1: 1.1
hashMap float1: 1.1
both should  should be 5.5

test2
float1: 1.1
hashMap float1: 5.5
both should  should be 5.5
</code></pre>
]]></description>
   </item>
   <item>
      <title>Simply  code in Andoid Mode</title>
      <link>https://forum.processing.org/two/discussion/27128/simply-code-in-andoid-mode</link>
      <pubDate>Fri, 23 Mar 2018 16:59:33 +0000</pubDate>
      <dc:creator>ermina</dc:creator>
      <guid isPermaLink="false">27128@/two/discussions</guid>
      <description><![CDATA[<p>In this code bellow i tried to load different texts(defferent names) from a list after touching the "Details" button on my device..The problem is that it shows me the name only fore some seconds but i want to stay there invariably..</p>

<pre><code>    import ketai.ui.*;
    import android.view.MotionEvent;

    Button on_button;  // the button
    int clk = 1;  

    KetaiGesture gesture;

    KetaiList klist;

    KetaiList selectionlist;
    ArrayList&lt;String&gt; textlist = new ArrayList&lt;String&gt;();

    void setup() {  
      size(1000,600);
      orientation(LANDSCAPE);
      textSize(28);
      textAlign(CENTER);
      gesture = new KetaiGesture(this);
       on_button = new Button("Details", 820, 420, 100, 50);
      textlist.add("Patient 1");
      textlist.add("Patient 2");
      textlist.add("Patient 3");
      textlist.add("Patient 4");
      textlist.add("Patient 15");
    }



    void mousePressed()
    {
      if (on_button.MouseIsOver()) {
        selectionlist = new KetaiList(this,textlist); 
      }
    }  
     void onKetaiListSelection(KetaiList klist)
    {
      String selection = klist.getSelection();
      if (selection == "Patient 1")
      fill(150);
         text("Kathy Smith",30,40);


       if (selection == "Patient 2")
         fill(150);
         text("John Doe",30,40);


       if (selection == "Patient 3")

         fill(150);

         text("Sue White",30,40);

       // if (selection == "Patient 4")



    }
    void draw() {  
     background(255);
        on_button.Draw();



    }
    // ==========================================================
     class Button {
      String label; // button label
      float x;      // top left corner x position
      float y;      // top left corner y position
      float w;      // width of button
      float h;      // height of button

      // constructor
      Button(String labelB, float xpos, float ypos, float widthB, float heightB) {
        label = labelB;
        x = xpos;
        y = ypos;
        w = widthB;
        h = heightB;
      }

      void Draw() {
        fill(150);
        stroke(141);
        rect(x, y, w, h, 10);
        textAlign(CENTER, CENTER);
        fill(0);
        text(label, x + (w / 2), y + (h / 2));
      }

      boolean MouseIsOver() {
        if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + w) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + h)) {
          return true;
        }
        return false;
      }
      public boolean surfaceTouchEvent(MotionEvent event) {
      // Call to keep mouseX and mouseY constants updated
      //super.surfaceTouchEvent(event);
      // Forward events
      return gesture.surfaceTouchEvent(event);
    }
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>loadStrings() is not working properly</title>
      <link>https://forum.processing.org/two/discussion/26975/loadstrings-is-not-working-properly</link>
      <pubDate>Wed, 21 Mar 2018 20:06:46 +0000</pubDate>
      <dc:creator>Nah</dc:creator>
      <guid isPermaLink="false">26975@/two/discussions</guid>
      <description><![CDATA[<p>I'm messing around <em>loadString()</em>, but i run into a problem what i don't really understand why happened.</p>

<p>Only <em>code 4</em> runs even if in the <em>file.txt</em> at the <em>l</em> line there is <em>FUNC1</em> , <em>FUNC2</em> or <em>FUNC3</em>.</p>

<pre><code>        String[] file;
        int l = 0;
        void setup() {
          file = loadStrings("file.txt");
        }
        void draw() {
          if(l &lt; file.length) {
            if(file[l] == "FUNC1"") {
              //code 1
            }else if(file[l] == "FUNC2") {
              //code 2
            }else if(file[l] == "FUNC3") {
              //code 3
            }else {
              //code 4
            }
          }
        }
</code></pre>
]]></description>
   </item>
   <item>
      <title>return int void error</title>
      <link>https://forum.processing.org/two/discussion/26435/return-int-void-error</link>
      <pubDate>Mon, 19 Feb 2018 16:24:23 +0000</pubDate>
      <dc:creator>GeorgeJava</dc:creator>
      <guid isPermaLink="false">26435@/two/discussions</guid>
      <description><![CDATA[<p>WHY pls help me :( iam very said</p>

<pre><code>void setup(){
  println(getTileID("grass"));
}

int getTileID(String name) {
  int id = 0;
 if (name.equals("stone")) {
     id = 41;
  } else if (name.equals("grass")) {
     id = 10;
  } else if (name.equals("wood")) {
     id = 23;
  } else {
    id = 0;
  }
  return id;
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>trouble comparing JSON getString result with string</title>
      <link>https://forum.processing.org/two/discussion/26384/trouble-comparing-json-getstring-result-with-string</link>
      <pubDate>Fri, 16 Feb 2018 16:46:43 +0000</pubDate>
      <dc:creator>Quebecsti</dc:creator>
      <guid isPermaLink="false">26384@/two/discussions</guid>
      <description><![CDATA[<p>Hello</p>

<p>I'm trying to learn the JSON and it's intricacies.</p>

<p>I'm using the JSONget example as a starter.. I want to do conditionnals, but it never returns true.</p>

<p>Even using the debugger, it all seem ok and the same, 
t and a will give type java.lang.String = "Wilbert"</p>

<p>what am I missing here?  I'm confused..</p>

<p>Thanks for the help</p>

<p>---- CODE --</p>

<pre><code>import http.requests.*;

public void setup() 
{
    size(100,100);
    smooth();

  GetRequest get = new GetRequest("<a href="http://connect.doodle3d.com/api/list.example" target="_blank" rel="nofollow">http://connect.doodle3d.com/api/list.example</a>");
  get.send(); // program will wait untill the request is completed
  println("response: " + get.getContent());

  JSONObject response = parseJSONObject(get.getContent());


  println("status: " + response.getString("status"));
  JSONArray boxes = response.getJSONArray("data");

  println("boxes: ");
  for(int i=0;i&lt;boxes.size();i++) {
    JSONObject box = boxes.getJSONObject(i);

    String t = box.getString("wifiboxid");
    String a = "Wilbert";

    println("t : "+ t);      //confirms the name to compare
    println(t.length());  // confirms length, so no extra characters
    println(a.length()); // confirms length, so no extra characters

    if ( t == a)  // compare but never true
      { 
       println("  wifiboxid: " + box.getString("wifiboxid"));
       println("   remoteip: " + box.getString("remoteip"));
      }
  }
}
</code></pre>

<p>---- JSON -----</p>

<p><a href="http://connect.doodle3d.com/api/list.example" target="_blank" rel="nofollow">http://connect.doodle3d.com/api/list.example</a></p>

<pre><code>    { 
        "status":"success",
        "data":[
                {
                    "id":"62.216.8.197\/10.0.0.18",
                    "remoteip":"62.216.8.197",
                    "localip":"10.0.0.18",
                    "wifiboxid":"Albert",
                    "hidden":"0",
                    "date":"2013-10-03 17:24:33",
                },
                {
                    "id":"62.216.8.197\/10.0.0.29",
                    "remoteip":"62.216.8.197",
                    "localip":"10.0.0.29",
                    "wifiboxid":"Wilbert",
                    "hidden":"0",
                    "date":"2013-10-03 17:52:19"
                }
               ],
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>how to perform a conditional check in processing on a value from serial read from arduino</title>
      <link>https://forum.processing.org/two/discussion/26127/how-to-perform-a-conditional-check-in-processing-on-a-value-from-serial-read-from-arduino</link>
      <pubDate>Fri, 26 Jan 2018 14:14:34 +0000</pubDate>
      <dc:creator>heaversm</dc:creator>
      <guid isPermaLink="false">26127@/two/discussions</guid>
      <description><![CDATA[<p>I have a simple push button connected to pin 2 on my arduino. I can read this value and print it to the serial monitor without any trouble:</p>

<p>```
int pushButton = 2;</p>

<pre><code>void setup() {
  Serial.begin(9600);
  pinMode(pushButton, INPUT);
}

void loop() {
  int buttonState = digitalRead(pushButton);
  Serial.println(buttonState);
  delay(1);        // delay in between reads for stability
}
</code></pre>

<p>```</p>

<p>This prints a value of 0 when the button is not pressed, and 1 if it is.</p>

<p>In processing I want to check if the value is zero or one, and perform some conditional logic. But I can't get the equality right:</p>

<p>```
    Serial myPort;
    String resultString;</p>

<pre><code>void setup(){
  size(640,480);
  printArray(Serial.list());
  String portName = Serial.list()[2];
  myPort = new Serial(this,portName,9600);
  myPort.bufferUntil(10);
}

void draw(){
  //
}

void serialEvent(Serial myPort){
  String inputString = myPort.readStringUntil(10); //until newline or ("\n");
  inputString = trim(inputString);
  println(inputString);
  if (inputString == "1"){ //this doesn't work, even though println will render ("1") plus the newline if button is pushed.
    println("on");
  } else {
    println("off");
  }
}
</code></pre>

<p>```</p>

<p>How do I set up this conditional to do one thing if the button is pushed, and another if it is not?</p>

<p>I've tried converting the string to an int using</p>

<p><code>inputInt = Integer.parseInt(inputString);</code></p>

<p>and then performing the check, but it didn't work.</p>
]]></description>
   </item>
   <item>
      <title>data format of dataPath</title>
      <link>https://forum.processing.org/two/discussion/25994/data-format-of-datapath</link>
      <pubDate>Tue, 16 Jan 2018 15:20:52 +0000</pubDate>
      <dc:creator>gellpro</dc:creator>
      <guid isPermaLink="false">25994@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>Isn't the format of dataPath String?
Although I wrote the following code, but A wasn't called.
Why isn't the println("A") called?</p>

<p>String data_path = dataPath("test");
if(data_path == dataPath("test")) {
    println("A");
}
else {
   println("B");
}</p>

<p>Best regards,
gellpro</p>
]]></description>
   </item>
   <item>
      <title>Login Screen</title>
      <link>https://forum.processing.org/two/discussion/25962/login-screen</link>
      <pubDate>Sun, 14 Jan 2018 22:04:36 +0000</pubDate>
      <dc:creator>procq</dc:creator>
      <guid isPermaLink="false">25962@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to make a login screen in which there are 2 windows and you enter a username and password and when you click enter it will switch to a second screen. I have gotten this far:</p>

<pre><code>//declare global variables
boolean slides[] = {true, false, false, false, false, false, false, false, false, false, false};
String topText = "";
String bottomText = ""; 
String wasText = "";
String bottomWasText = ""; 
boolean username = true;
void setup() {
  size(600, 600);
}
//Function to draw (every procedure is called here)
void draw() { 
  loginMenu(); 

  tableOfContents();  


}
//Function(Procedure) controls Login Menu. 
void loginMenu() { 
  if (slides[0] == true) {
    background(255);
    rectMode(CENTER); 
    fill(255);
    rect(300, 200, 300, 100);
    rect(300, 400, 300, 100);
    fill(0);
    textSize(20);
    text(topText, 200, 215);
    text(bottomText, 200, 375);
    text(wasText, 200, 215);

  }
} 

//allows keyboard input for various things
void keyPressed() {

  if (slides[0] == true) {

    if ((keyCode == BACKSPACE &amp;&amp; topText.length() &gt; 0)) 
    { 
      if (username == true) {
        topText = topText.substring(0, topText.length()-1);
      }
    }
    if ((keyCode == BACKSPACE &amp;&amp; bottomText.length() &gt; 0) ) {
      if (username == false) {
        bottomText = bottomText.substring(0, bottomText.length()-1);
      }
    }
      else if (keyCode == ENTER) 
    {           
      username = false;
      wasText = topText;
      bottomWasText = bottomText;
      if (wasText == "username" &amp;&amp; bottomWasText == "password") {
           slides[0] = false;
        slides[1] = true; 


      }
    } else if ((key &gt;= 32 &amp;&amp; key &lt;= 126))//add char to string
    {
      if (username == true) {
        topText = topText + key;
      } else {
        bottomText = bottomText +key;
      }
    }
  }
  }

void tableOfContents() {
  if (slides[1] == true) {
    background(255); 
    fill(0); 
    rect(250, 250, 30, 30);
  }
}
</code></pre>

<p>Why won't it switch to the tableOfContents screen when you type in "username" and "password".</p>
]]></description>
   </item>
   <item>
      <title>Exported Application freezing on MacOS</title>
      <link>https://forum.processing.org/two/discussion/25938/exported-application-freezing-on-macos</link>
      <pubDate>Sat, 13 Jan 2018 16:30:29 +0000</pubDate>
      <dc:creator>thesuperdaine</dc:creator>
      <guid isPermaLink="false">25938@/two/discussions</guid>
      <description><![CDATA[<p>I am making a game with Processing 3, and it runs perfectly in the PDE; although, when I export the application and run it, the game freezes when a certain method is called: <code>gameOver()</code>. The <code>gameOver()</code> method is called whenever the player is hurt by an enemy (which is whenever an enemy touches the player).</p>

<p>The only thing that I can think of is that it loads an image, but I have used the add file button to add the image and everything.</p>

<p>I'm running macOS Sierra 10.12.6.</p>

<p>Here is the link to the code and applications.
<a href="http://www.mediafire.com/folder/seq00jfeqsl69/Open_Desktop_Adventure" target="_blank" rel="nofollow">http://www.mediafire.com/folder/seq00jfeqsl69/Open_Desktop_Adventure</a></p>
]]></description>
   </item>
   <item>
      <title>Play video using Processing, Arduino and PIR Sensor</title>
      <link>https://forum.processing.org/two/discussion/25365/play-video-using-processing-arduino-and-pir-sensor</link>
      <pubDate>Sun, 03 Dec 2017 22:41:30 +0000</pubDate>
      <dc:creator>m4rdones</dc:creator>
      <guid isPermaLink="false">25365@/two/discussions</guid>
      <description><![CDATA[<p>Hi. A friend and I are in the middle of a video installation tests. I'm using an Arduino PIR Sensor and an Arduino Uno board.</p>

<p>I need to stop a video when the PIR is "On" (Detects motion) and to play that video if the PIR is "Off".</p>

<p>Checking the Processing and Arduino websites, examples and references I couldn't figured out what I'm doing wrong.
Please let me know if something is missing or left.
Thanks in advance for any help!</p>

<p>This is the Arduino Code (copied from Arduino and Processing communication tutorials found on the web):</p>

<pre><code>/*
   PIR sensor tester
*/

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input

  Serial.begin(9600);
}

void loop() {
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH) {
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}
</code></pre>

<p>And here is the Processing code:</p>

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

Serial myPort;
String val;    

Movie video;

void setup() {
  size(640,480);
  video = new Movie(this,"sujeto1.mp4");
  video.loop();
  String portName = Serial.list()[0];
  myPort = new  Serial(this, portName, 9600);
  myPort.bufferUntil('\n');
}

void serialEvent (Serial myPort) {
  if (myPort.available() &gt; 0) {
    val=myPort.readStringUntil('\n');
  }
  if (val=="Motion detected!") {
    video.stop();
  } else {
    video.loop();
  }
  println(val);

}
void draw() {
  background(0);
  image(video,0,0);

} 

void movieEvent(Movie video) {
  video.read();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>readString Weirdness (Client/Server)</title>
      <link>https://forum.processing.org/two/discussion/25134/readstring-weirdness-client-server</link>
      <pubDate>Tue, 21 Nov 2017 22:36:53 +0000</pubDate>
      <dc:creator>SDhn2a</dc:creator>
      <guid isPermaLink="false">25134@/two/discussions</guid>
      <description><![CDATA[<p>First off, this is my first post here, so I apologize in advance for any mistakes I may have made.</p>

<p>So I've been working on setting up a Client/Server system, and I'm trying to get them to send Strings to each other. However, I was running into a very strange issue: whenever I set some variable equal to readString(), the program seems unable to recognize it as a string. After toying around with it for a while, I wrote a minimalist code to demonstrate the source of my confusion...</p>

<p>First, the Server code:</p>

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

Server server;

void setup() {
  size(600,400);
  server = new Server(this, 5204);
}

void draw(){
  Client client = server.available();
  if (client != null) {
    String msg = client.readString();
    println(msg);
    println(msg == "k");
  }
}
</code></pre>

<p>Next, the Client code:</p>

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

Client client;

void setup() {
  size(400, 200);
  client = new Client(this, "127.0.0.1", 5204); //I replaced 127.0.0.1 with my IP address in the actual code
}

void draw() {
}

void mouseClicked(){
  client.write("k");
}
</code></pre>

<p>I would have expected it to return "k", then "true", but it returns "k", then "false". Is readString() not actually a string or something? What's going on?</p>

<p>Any and all help would be appreciated.</p>
]]></description>
   </item>
   <item>
      <title>I can't control when the response in the textfield.</title>
      <link>https://forum.processing.org/two/discussion/24340/i-can-t-control-when-the-response-in-the-textfield</link>
      <pubDate>Mon, 02 Oct 2017 08:57:17 +0000</pubDate>
      <dc:creator>Créol</dc:creator>
      <guid isPermaLink="false">24340@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>I have a little problem with my programme.</p>

<p>I would like to control if the text in the textfield is good or not but it doesn't work.</p>

<p>I can get the text in the textfield but when I want to check if it's good it doesn't work.</p>

<p>Some one has a solution for me please?</p>

<p>The code is here :</p>

<pre><code>String Reponse = "oui";

import controlP5.*;

ControlP5 cp5;

void setup() {
  size(700,400);

  PFont font = createFont("arial",20);

  cp5 = new ControlP5(this);

  cp5.addTextfield("input")
     .setPosition(20,100)
     .setSize(200,40)
     .setFont(font)
     .setFocus(false)
     .setColor(color(255,0,0))
     ;
      cp5.addBang("clear")
     .setPosition(240,170)
     .setSize(80,40)
     .getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)
     ;    

    textFont(font);
}

void draw() {
  background(0);
  fill(255);
  text("Ecrivez votre réponse ici",20,90);
  text(cp5.get(Textfield.class,"input").getText(), 360,130);
  if(cp5.get(Textfield.class,"input").getText() == Reponse){
    text("Vrai",20,20);
  }
}

public void clear() {
  cp5.get(Textfield.class,"input").clear();
}
</code></pre>

<p>thank you</p>
]]></description>
   </item>
   <item>
      <title>Replacing characters of string array with numbers</title>
      <link>https://forum.processing.org/two/discussion/24150/replacing-characters-of-string-array-with-numbers</link>
      <pubDate>Sun, 17 Sep 2017 20:05:56 +0000</pubDate>
      <dc:creator>Noradz471</dc:creator>
      <guid isPermaLink="false">24150@/two/discussions</guid>
      <description><![CDATA[<p>So I have 2 .txt files, one (test.txt) contains a quote and the other (data.txt) contains all of the characters that can possibly occur in it. Each one has been formatted so that each character is on a new line and each string in the array contains a single character.  What I need to do is convert each character in test.txt into an integer that corresponds with the index of the identical character in data.txt.  For example: a=0, b=1, c=2...</p>

<pre><code>//arrays for .txt files
String[] data;
String[] test;
//stores length of total characters in data.txt
int num;
//stores length of total characters in test.txt
int total;

data = loadStrings("data.txt");
num = data.length;
test = loadStrings("test.txt");
total = test.length;

//conversion
for (int i = 0; i &lt; total; i++) {
  String x = test[i];
  for (int j = 0; j &lt; num; j++){
    String y = data[j];
    if(x == y){
        x = j;
        break;
     }else{
       continue;
     }
  }
}
</code></pre>

<p>I get an error on line 20 "cannot convert from int to String"</p>
]]></description>
   </item>
   <item>
      <title>!= not working for string</title>
      <link>https://forum.processing.org/two/discussion/23926/not-working-for-string</link>
      <pubDate>Fri, 25 Aug 2017 20:58:01 +0000</pubDate>
      <dc:creator>jeffmarc</dc:creator>
      <guid isPermaLink="false">23926@/two/discussions</guid>
      <description><![CDATA[<p>OK this is weird.</p>

<p>i have a string 12345.xxx</p>

<pre><code>println(string.substring(string.length() - 3); // prints xxx to console
</code></pre>

<p>next line is:</p>

<pre><code>if (string.substring(string.length() - 3) != "xxx")  {
  println(string + "yyy");
}
</code></pre>

<p>this is what prints to console:</p>

<p>12345.xxxyyy</p>

<p>It seems the if does not recognize the comparison!</p>

<p>I can't figure out why</p>
]]></description>
   </item>
   <item>
      <title>[SOLVED] Trying to convert Coding Challenge #10.2: Maze Generator with p5.js to processing code</title>
      <link>https://forum.processing.org/two/discussion/23577/solved-trying-to-convert-coding-challenge-10-2-maze-generator-with-p5-js-to-processing-code</link>
      <pubDate>Tue, 25 Jul 2017 03:48:05 +0000</pubDate>
      <dc:creator>wraithious</dc:creator>
      <guid isPermaLink="false">23577@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I was watching one of Dan's cool videos and there's one in particular that I tried to follow, and convert it from p5.js to processing 3 but I can't get past the 2nd video called 
<a rel="nofollow" href="https://www.youtube.com/watch?v=D8UgRyRnvXU&amp;t=55s">Coding Challenge #10.2: Maze Generator with p5.js - Part 2</a></p>

<p>the code below is what I have done, but the result is it draws a bunch of random blank squares, purple squares, and green squares, eventually all but 1 is purple and the last one is green, do you know what I'm doing wrong that would cause this? also none of the grid lines are disappearing as the maze progresses :( I've been at this for 4 days now haha</p>

<pre><code>int w=20;
int cols=floor(400/w);
int rows=floor(400/w);
int[] x = new int[rows+1];
int[] y = new int[cols+1];
int[][] visited = new int[cols+1][rows+1];
boolean[][][] wallPos=new boolean[5][cols+1][rows+1];
int current=0;
void setup() {
  size(401, 401);
  frameRate(1);
  for (int i=0; i&lt;4; i++) {
    for (int j=0; j&lt;rows; j++) {
      for (int k=0; k&lt;cols; k++) {
        wallPos[i][j][k]=true;
      }
    }
  }
  for (int i=0; i&lt;rows; i++) {
    for (int j=0; j&lt;cols; j++) {
      if (i==0 &amp;&amp; j==0) {
        visited[0][0]=1;
      }
      if ((i!=0 &amp;&amp; j==0) || j&gt;0) {
        visited[i][j]=0;
      }
    }
  }
}

int index(int r, int s) {
  if (r&lt;0 || s&lt;0 || r&gt;cols-1 || s&gt;rows-1) {
    return -1;
  } 
  return r+s*cols;
}

void draw() {
  background(51); 
  stroke(255);
  for (int j=0; j&lt;rows; j++) {
    for (int i=0; i&lt;cols; i++) {
      String[] picker = new String[5];
      for (int k=0; k&lt;4; k++) {
        picker[k]="nobody";
      }
      int checker=0;
      int p=0;
      p=round(random(3));
      while (picker[p]=="nobody") {
        if (index(i, j-1)!=-1 &amp;&amp; p==0 &amp;&amp; visited[i][j-1]==0)
        {
          picker[0]="top";
          visited[i][j-1]=1;
          wallPos[0][i][j]=false;
          wallPos[2][i][j-1]=false;
          current=index(i, j);
          checker=1;
        }
        if (index(i+1, j)!=-1 &amp;&amp; p==1 &amp;&amp; visited[i+1][j]==0)
        {
          picker[1]="right";
          visited[i+1][j]=1;
          wallPos[1][i][j]=false;
          wallPos[3][i+1][j]=false;
          current=index(i, j);
          checker=1;
        }
        if (index(i, j+1)!=-1 &amp;&amp; p==2 &amp;&amp; visited[i][j+1]==0)
        {
          picker[2]="bottom";
          visited[i][j+1]=1;
          wallPos[2][i][j]=false;
          wallPos[0][i][j+1]=false;
          current=index(i, j);
          checker=1;
        }
        if (picker[3]=="nobody" &amp;&amp; index(i-1, j)!=-1 &amp;&amp; p==3 &amp;&amp; visited[i-1][j]==0)
        {
          picker[3]="left";
          visited[i-1][j]=1;
          wallPos[3][i][j]=false;
          wallPos[1][i-1][j]=false;
          current=index(i, j);
          checker=1;
        } 
        if (checker==1 || (picker[0]=="nobody" &amp;&amp; picker[1]=="nobody" &amp;&amp; picker[2]=="nobody" &amp;&amp; picker[3]=="nobody")) break;
      }
      x[i]=i*w;
      y[j]=j*w;
      if (wallPos[0][i][j]==true) {
        line(x[i], y[j], x[i]+w, y[j]);
      }
      if (wallPos[1][i][j]==true) {
        line(x[i]+w, y[j], x[i]+w, y[j]+w);
      }
      if (wallPos[2][i][j]==true) {
        line(x[i]+w, y[j]+w, x[i], y[j]+w);
      }
      if (wallPos[3][i][j]==true) {
        line(x[i], y[j]+w, x[i], y[j]);
      }
      if (visited[i][j]==1) {
        fill(255, 0, 255);
        rect(x[i], y[j], w, w);
      }
      if (current==index(i, j)) {
        fill(0, 255, 0);
        rect(x[i], y[j], w, w);
      }
    }
  }
}`
</code></pre>
]]></description>
   </item>
   <item>
      <title>Working on a code to take input from an Arduino and display the data using Processing.</title>
      <link>https://forum.processing.org/two/discussion/23295/working-on-a-code-to-take-input-from-an-arduino-and-display-the-data-using-processing</link>
      <pubDate>Mon, 03 Jul 2017 11:08:57 +0000</pubDate>
      <dc:creator>bsmyname</dc:creator>
      <guid isPermaLink="false">23295@/two/discussions</guid>
      <description><![CDATA[<p>I have a code written in Arduino that turns the led off and on using if statements.  It displays in the serial monitor the status of the LED and its "input".  It displays 'LED is ON.' 'LED is OFF.' or 'Invalid' depending on what would be the input from the user.  Currently it's automated so I can leave it alone and it scrolls through on off and then invalid every two seconds so I can work on the Processing code.  In Processing, I can bring in the data and display each result once but the code either gets stuck at the end of the loop and draw doesn't seem to run again or there is something wrong with my serial event and my string input from the Arduino doesn't update.  I have attached the Processing code if that will help in understanding what I am trying to do.</p>

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

String serialMonitor = "LED is ON!";       //Determining empty string allows loop to run the first time
String txt = "Unknown!";
String data;
String ledOn = "LED is ON!";
String ledOff = "LED is OFF!";
String invld = "Invalid!";
PFont font;              //Activates font


void setup() {
  size(400, 400);                                          //Determines window size
  port = new Serial(this, "COM4", 9600);                   //
  port.bufferUntil('!');                                   //
  font = loadFont("AmerTypewriterITCbyBT-Medium-48.vlw");     //
  textFont(font, 48);                                     //
  frameRate(60);
}

void draw() {
  background(0);

 if (serialMonitor.equals(ledOn) == true) {
     rectMode(CENTER);
  text(serialMonitor, 200, 200, 300, 50);
  fill(234, 255, 45);                                   //When LED is on
 }

if (serialMonitor.equals(ledOff) == true) {
     rectMode(CENTER);
  text(serialMonitor,200, 200, 300, 50);
  fill(42, 20, 168);                                        //When LED is off  
 }

 if (serialMonitor.equals(invld) == true) {
     rectMode(CENTER);
  text(serialMonitor, 200, 200, 300, 50);
  fill(230, 11, 11);                                  //When input is Invalid
 }

 else {
     rectMode(CENTER);
  text(txt, 200, 200, 300, 50);
  fill(237,233,220);
 }
}

void serialEvent (Serial port) {
serialMonitor = port.readStringUntil('!');        //Reads incoming data string
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Serial Communication.</title>
      <link>https://forum.processing.org/two/discussion/22971/serial-communication</link>
      <pubDate>Wed, 07 Jun 2017 08:13:56 +0000</pubDate>
      <dc:creator>Noerrenebels</dc:creator>
      <guid isPermaLink="false">22971@/two/discussions</guid>
      <description><![CDATA[<p>Hello,
the following Code:</p>

<p><code>void serialEvent(Serial p) {
  message = myPort.readStringUntil(124);
  if (message != null) {
    int messageLength = message.length();
    message = message.substring(0, messageLength - 1);
    println(message);
    try {
      elements = split(message, ":");
      println(elements[0]+"????");
      println(elements[0].equals("Panel"));
      if (elements[0].equals("Panel") == true) {
        panel = int (elements[1]);
        println("Panel = " + str(panel));
      }
    }
    catch (Exception e) {
    }
  }
}</code></p>

<p>Print out to Console:</p>

<hr />

<p>`Panel:1
Panel????
true
Panel = 1</p>

<p>Panel:2</p>

<p>Panel????
false</p>

<h2>`</h2>

<p>Why the second time 'elements[0].equals("Panel")' is false?</p>

<p>Sincerly
Jörg</p>
]]></description>
   </item>
   <item>
      <title>More elegant solution?</title>
      <link>https://forum.processing.org/two/discussion/22958/more-elegant-solution</link>
      <pubDate>Tue, 06 Jun 2017 15:15:49 +0000</pubDate>
      <dc:creator>rn42vlr</dc:creator>
      <guid isPermaLink="false">22958@/two/discussions</guid>
      <description><![CDATA[<p>Hi there,
do you have a more elegant solution to this?:</p>

<p><code>  void show(String side){
    if(side == "right"){
      rect(rPx, rPy, paddleWidth, paddleHeight);
      rPy += yspeed;
    }
    if(side == "left"){
      rect(lPx, lPy, paddleWidth, paddleHeight);
      lPy += yspeed;
    }
  }</code></p>

<p>Depending on the parameter the rectangels should be on the left or right side.
It's working just fine, I just don't feel like it's nice code...</p>
]]></description>
   </item>
   <item>
      <title>Server and Client &gt; if(sendMessages=="hello") {any...}  //doesnt working :(</title>
      <link>https://forum.processing.org/two/discussion/22915/server-and-client-if-sendmessages-hello-any-doesnt-working</link>
      <pubDate>Sun, 04 Jun 2017 12:25:10 +0000</pubDate>
      <dc:creator>GeorgeJava</dc:creator>
      <guid isPermaLink="false">22915@/two/discussions</guid>
      <description><![CDATA[<p>code:</p>

<pre lang="javascript">
import processing.net.*; 
Client myClient; 
String inString;
byte interesting = 10;

void setup() { 
  size (300, 100);
  myClient = new Client(this, "127.0.0.1", 12345); 
} 

void draw() { 
  
  if (myClient.available() &gt; 0) { 
    background(0); 
    inString = myClient.readStringUntil(interesting); 
    println(inString); 
    if (inString.equals("hello") == true) { // -this not working...
      exit();
    } 
  } else {
    background(0,25,59);
  }
}
</pre>

<p>and server:</p>

<pre lang="javascript">
import processing.net.*;

Server s; 
Client c;
String input;
int data[];

void setup() { 
  size(450, 255);
  background(204);
  s = new Server(this, 12345);
} 

void draw() { 
  if (mousePressed == true) {
    s.write("hello\n");
  }
}
</pre>
]]></description>
   </item>
   <item>
      <title>If statement doesn't work</title>
      <link>https://forum.processing.org/two/discussion/22681/if-statement-doesn-t-work</link>
      <pubDate>Sat, 20 May 2017 13:56:34 +0000</pubDate>
      <dc:creator>Taalik</dc:creator>
      <guid isPermaLink="false">22681@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>So with processing i'm reading a text file into a string. I only want to send data to the serial port if there is new data in the text file. So in the setup part i created a string[] lines that loads into a string the content of the text file.</p>

<p>In the main loop i create a string[] linesTemp that loads the content of the same file. Then i make a if to compare the two strings. If the two strings are equal i print "same". The issue is that the two strings have the same values but i don't know why it doesn't go into the if statement and print "same" in the console. 
Thanks !</p>

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

<pre><code>import processing.serial.*;
import java.io.*;
Serial myPort;

String[] lines; 

int b =0;
int c =0;

void setup() {
  //Make sure the COM port is correct
  myPort = new Serial(this, "COM5", 9600);
  myPort.bufferUntil('\n');
  lines = loadStrings("matrice.txt");
}

int counter=0;

void draw() {


  String[] linesTemp = loadStrings("matrice.txt");


  for (int a=0; a&lt;(lines.length); a++)
  {
    println("ligne : ", b++, lines[a]);
    println("ligneTemp : ", c++, linesTemp[a]);

    if (linesTemp[a] == lines[a])
    {
      println("same");
    } else if (linesTemp[a] != lines[a]) {

      lines[a] = linesTemp[a];
      myPort.write(""+linesTemp[a]);
    }
  }
  delay(1000);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to nicely extract data from a .csv table and display it ?</title>
      <link>https://forum.processing.org/two/discussion/21854/how-to-nicely-extract-data-from-a-csv-table-and-display-it</link>
      <pubDate>Thu, 06 Apr 2017 10:04:58 +0000</pubDate>
      <dc:creator>Spiritofthecode</dc:creator>
      <guid isPermaLink="false">21854@/two/discussions</guid>
      <description><![CDATA[<p>Hello there !</p>

<p>I've got 2 csv files on my hand ; the first  listing restaurants, with 3 columns(coordinate x, coordinate y, restaurant name) and another listing deliveries (coordinate x, delivery coordinate y , name of the restaurante the delivery was done by).</p>

<p>I need to :
1) Display the number of deliveries made for each restaurant. 
2) The average distance of the deliveries for each restaurant (distance being calculated by this formula = sqrt(sq(x1-x2)+sq(y1-y2) at least I figured something out :p)</p>

<p>For the first, I made a class which looks like this :</p>

<p>Then I'm trying to go trought the deliveries table and change the arraylist of objects so that when the string happens to be the same in a row and the arraylist object the object counts gets to +1. But it doesn't seem to work. Any tips appreciated for the step 2, also.</p>
]]></description>
   </item>
   <item>
      <title>How to read text file into array</title>
      <link>https://forum.processing.org/two/discussion/20641/how-to-read-text-file-into-array</link>
      <pubDate>Sat, 04 Feb 2017 21:07:29 +0000</pubDate>
      <dc:creator>Merlin04</dc:creator>
      <guid isPermaLink="false">20641@/two/discussions</guid>
      <description><![CDATA[<p>I just started this morning with Processing. I want to be able to take a text file:</p>

<pre><code>Hello world
abc
123
</code></pre>

<p>And get this:</p>

<p><code>["Hello World", "abc", "123"]</code></p>

<p>How can I do this?</p>
]]></description>
   </item>
   <item>
      <title>Convert key to str for use in function</title>
      <link>https://forum.processing.org/two/discussion/19710/convert-key-to-str-for-use-in-function</link>
      <pubDate>Mon, 12 Dec 2016 21:02:15 +0000</pubDate>
      <dc:creator>red_orchestra</dc:creator>
      <guid isPermaLink="false">19710@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I'm having a little trouble resolving a function. The idea is to make every key on the keyboard do something different. But for some reason I can't resolve the char of "key" into a string - when I try the following basic code, nothing happens when I hit a key</p>

<p>It goes something like this (I will just paste the relevant code):</p>

<pre><code>    void setup(){
      size(300, 300);
      background(255, 0,0);
    }

    void draw(){

    String curr = "0";
      curr = str(key); //parenthesis (pause!)

      if(curr == "p"){
        background(0);
      }
      if(curr == "q"){
        background(255);
      }

      println(curr + " is the current key");
    }
</code></pre>

<p>println shows me that the key is working in conversion, but for some reason I can't seem to get the function working. I've trawled the forums but haven't come across this - I would be very grateful if anyone can point me to an answer in another forum post, or let me know if you can spot what I'm doing wrong!</p>

<p>Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Read data from serial(from another arduino through xbee) to usable string</title>
      <link>https://forum.processing.org/two/discussion/18905/read-data-from-serial-from-another-arduino-through-xbee-to-usable-string</link>
      <pubDate>Sun, 06 Nov 2016 09:53:01 +0000</pubDate>
      <dc:creator>amiz</dc:creator>
      <guid isPermaLink="false">18905@/two/discussions</guid>
      <description><![CDATA[<p>this is sender node :</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/913/R7A6TTJLKB3V.PNG" alt="sender" title="sender" /></p>

<p>My problem is when it receive "node1" from sender through xbee, the condition is aborted..
BUT, when i  manually write in serial, the condition is worked..
i think the data sent by sender is not actually "node1"..even when i Serial.print(), it shows ""node1" physically.</p>

<p>this is receiver node:</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/720/BCFSJ1PKRIN5.PNG" alt="receiver" title="receiver" /></p>
]]></description>
   </item>
   <item>
      <title>moving object(words)</title>
      <link>https://forum.processing.org/two/discussion/18647/moving-object-words</link>
      <pubDate>Fri, 21 Oct 2016 08:00:05 +0000</pubDate>
      <dc:creator>hardbrain</dc:creator>
      <guid isPermaLink="false">18647@/two/discussions</guid>
      <description><![CDATA[<p>hello, I'm studying for my project with the leap motion and processing. It's my first time to do programming, I'm trying to mix up some of sketches i found and to change little bit.
based on <a href="https://www.openprocessing.org/collection/2560" target="_blank" rel="nofollow">https://www.openprocessing.org/collection/2560</a></p>

<p>whatever, Here is my Question.</p>

<ol>
<li>how to change WordPaint axis? It moves to the left around the edges.
1-1. how to make to move WordPaint automatically on Y axis only? (wants to move like BBQ)</li>
<li>Wants to limit space. move inside on 'size' </li>
</ol>

<hr />

<pre lang="javascript">

   import peasy.*;
   import com.leapmotion.leap.*;

   int width = 400;
   int height = 400;

float turns = radians(360);
float xRotation = 0;
float yRotation = 0;
float zRotation = 0;
Controller leap = new Controller();
// variables =============================================

// Camera
PeasyCam cam;

int bufferSize = 1256;
int bufferWritePosition = 0;
String[] buffer = new String[bufferSize];

int factorBetweenBoxes = 3;
int factorBetweenLetters = 30;
float angle = 0.0001;
float angleAdd = 0.009;
float jitter;

// letterSpacing: use -6 for 'W' to put more space after the W 
int letterSpacing = 0; 

// functions =============================================

void setup () {

  size (1000, 1000, P3D);
  cam = new PeasyCam(this, 2000.0 );
  cam.pan(170, 400);  

 
  noSmooth(); 
  fill(color(255, 255, 255));
  stroke(color(25,25,0));
}

void draw () {
  Frame frame = leap.frame();
  Hand hand = frame.hands().frontmost();
  if ( hand.isValid() )
  {
    InteractionBox box = frame.interactionBox();
    Vector controlPosition = hand.palmPosition();
    Vector normalizedPosition = box.normalizePoint(controlPosition, false);
    xRotation = turns * normalizedPosition.getX();
    yRotation = turns * (1 - normalizedPosition.getY());
    zRotation = turns * (1 - normalizedPosition.getZ());
  }

  background(0);
 
  rotateX(zRotation);
  rotateY(xRotation);
  rotateZ(yRotation);
  translate(width/2, height/8);
   if (second() % 2 == 0) {  
    jitter = random(-0.0001, 0.0001);
  }
  angle = angle + jitter;
  float c = cos(angle/2);
  translate(width/2, height/2);
  rotate(c);
  
  WordPaint("I HATE YOU");
  angle += angleAdd/5;
}

void keyPressed() {
  if (key == CODED) {
    if (keyCode == UP) {
      factorBetweenBoxes-=1;
    } else if (keyCode == DOWN) {
      factorBetweenBoxes+=1;
    } 
    if (keyCode == LEFT) {
      factorBetweenLetters-=1;
    } else if (keyCode == RIGHT) {
      factorBetweenLetters+=1;
    }
  } else {
    // not coded 
    if (key == '1') {
      if (angleAdd==0.0) {
        angleAdd=0.009;
      } else {
        angleAdd=0.0;
      };
    } // SPACE
    else if (key == 'm') {
      angleAdd=0.1;
    }
  } // else not coded
} // func 

void WordPaint(String InputWordOfFunction) {
  final int BoxWidth=3; 
  letterSpacing=0;
  for (int i = 0; i &lt; InputWordOfFunction.length(); i = i+1) {
    buffer = new String[bufferSize];
    bufferWritePosition=0;
    letterSpacing=0; 
    keyPaintHelper(InputWordOfFunction.charAt(i));
    for (int  j = 0; j &lt; bufferWritePosition; j = j+1) {
      for (int  k = 0; k &lt; buffer[j].length(); k = k+1) {
        if (buffer[j].charAt(k) == '*') {
          pushMatrix();
          translate((j*factorBetweenBoxes)+(i*factorBetweenLetters)-100+letterSpacing, 
            300-(k*factorBetweenBoxes)+100, 
            -1); 
          // rotateY(0.3); //  ;-) 
          box (BoxWidth, BoxWidth, BoxWidth+BoxWidth+BoxWidth);
          popMatrix();
        }
      }
    }
  }
}

void keyPaintHelper(char InputKeyOfFunction) {
  char k = Character.toUpperCase(InputKeyOfFunction);
  letterSpacing=0;
  switch(k) {
  case 'A':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "   *   * ";
      buffer[bufferWritePosition + 3] = "   *   * ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = " ******  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'B':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *  *  * ";
      buffer[bufferWritePosition + 3] = " *  *  * ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = "  ** **  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'C':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  *****  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *     * ";
      buffer[bufferWritePosition + 3] = " *     * ";
      buffer[bufferWritePosition + 4] = " *     * ";
      buffer[bufferWritePosition + 5] = "  *   *  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'D':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *     * ";
      buffer[bufferWritePosition + 3] = " **   ** ";
      buffer[bufferWritePosition + 4] = "  *****  ";
      buffer[bufferWritePosition + 5] = "   ***   ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'E':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *  *  * ";
      buffer[bufferWritePosition + 3] = " *  *  * ";
      buffer[bufferWritePosition + 4] = " *  *  * ";
      buffer[bufferWritePosition + 5] = " *     * ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'F':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "    *  * ";
      buffer[bufferWritePosition + 3] = "    *  * ";
      buffer[bufferWritePosition + 4] = "    *  * ";
      buffer[bufferWritePosition + 5] = "       * ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'G':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  *****  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " ** *  * ";
      buffer[bufferWritePosition + 3] = " ** *  * ";
      buffer[bufferWritePosition + 4] = " **** ** ";
      buffer[bufferWritePosition + 5] = " **** *  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'H':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "    *    ";
      buffer[bufferWritePosition + 3] = "    *    ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = " ******* ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'I':
    if (thereAreEnoughSlots(6)) {
      buffer[bufferWritePosition + 0] = "         ";
      buffer[bufferWritePosition + 1] = " *     * ";
      buffer[bufferWritePosition + 2] = " ******* ";
      buffer[bufferWritePosition + 3] = " ******* ";
      buffer[bufferWritePosition + 4] = " *     * ";
      buffer[bufferWritePosition + 5] = "         ";
      bufferWritePosition += 6;
    }
    break;
  case 'J':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  **     ";
      buffer[bufferWritePosition + 1] = " ***     ";
      buffer[bufferWritePosition + 2] = " *     * ";
      buffer[bufferWritePosition + 3] = " ******* ";
      buffer[bufferWritePosition + 4] = "  ****** ";
      buffer[bufferWritePosition + 5] = "       * ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'K':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "   ***   ";
      buffer[bufferWritePosition + 3] = "  ** **  ";
      buffer[bufferWritePosition + 4] = " **   ** ";
      buffer[bufferWritePosition + 5] = " *     * ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'L':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *       ";
      buffer[bufferWritePosition + 3] = " *       ";
      buffer[bufferWritePosition + 4] = " *       ";
      buffer[bufferWritePosition + 5] = " *       ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'M':
    if (thereAreEnoughSlots(9)) {
      buffer[bufferWritePosition + 0] = " ******  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "    **** ";
      buffer[bufferWritePosition + 3] = "  ****   ";
      buffer[bufferWritePosition + 4] = "  ****   ";
      buffer[bufferWritePosition + 5] = "    **** ";
      buffer[bufferWritePosition + 6] = " ******* ";
      buffer[bufferWritePosition + 7] = " ******  ";
      buffer[bufferWritePosition + 8] = "         ";
      bufferWritePosition += 9;
    }
    break;
  case 'N':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "    **   ";
      buffer[bufferWritePosition + 3] = "   **    ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = " ******* ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'O':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  *****  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *     * ";
      buffer[bufferWritePosition + 3] = " *     * ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = "  *****  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'P':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "    *  * ";
      buffer[bufferWritePosition + 3] = "    *  * ";
      buffer[bufferWritePosition + 4] = "    **** ";
      buffer[bufferWritePosition + 5] = "     **  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'Q':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  *****  ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " **    * ";
      buffer[bufferWritePosition + 3] = " **    * ";
      buffer[bufferWritePosition + 4] = "******** ";
      buffer[bufferWritePosition + 5] = "* *****  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'R':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " ******* ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = "   **  * ";
      buffer[bufferWritePosition + 3] = "  ***  * ";
      buffer[bufferWritePosition + 4] = " ** **** ";
      buffer[bufferWritePosition + 5] = " *   **  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'S':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  ** **  ";
      buffer[bufferWritePosition + 1] = " ** **** ";
      buffer[bufferWritePosition + 2] = " *  *  * ";
      buffer[bufferWritePosition + 3] = " *  *  * ";
      buffer[bufferWritePosition + 4] = " **** ** ";
      buffer[bufferWritePosition + 5] = "  ** **  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'T':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "       * ";
      buffer[bufferWritePosition + 1] = "       * ";
      buffer[bufferWritePosition + 2] = " ******* ";
      buffer[bufferWritePosition + 3] = " ******* ";
      buffer[bufferWritePosition + 4] = "       * ";
      buffer[bufferWritePosition + 5] = "       * ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'U':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "  ****** ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " *       ";
      buffer[bufferWritePosition + 3] = " *       ";
      buffer[bufferWritePosition + 4] = " ******* ";
      buffer[bufferWritePosition + 5] = "  ****** ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'V':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "   ***** ";
      buffer[bufferWritePosition + 1] = "  ****** ";
      buffer[bufferWritePosition + 2] = " **      ";
      buffer[bufferWritePosition + 3] = " **      ";
      buffer[bufferWritePosition + 4] = "  ****** ";
      buffer[bufferWritePosition + 5] = "   ***** ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'W':
    letterSpacing=-6 ; // -6 for 'W'
    if (thereAreEnoughSlots(9)) {
      buffer[bufferWritePosition + 0] = "  ****** ";
      buffer[bufferWritePosition + 1] = " ******* ";
      buffer[bufferWritePosition + 2] = " **      ";
      buffer[bufferWritePosition + 3] = "  ****   ";
      buffer[bufferWritePosition + 4] = "  ****   ";
      buffer[bufferWritePosition + 5] = " **      ";
      buffer[bufferWritePosition + 6] = " ******* ";
      buffer[bufferWritePosition + 7] = "  ****** ";
      buffer[bufferWritePosition + 8] = "         ";
      bufferWritePosition += 9;
    }
    break;
  case 'X':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " **   ** ";
      buffer[bufferWritePosition + 1] = " *** *** ";
      buffer[bufferWritePosition + 2] = "   ***   ";
      buffer[bufferWritePosition + 3] = "   ***   ";
      buffer[bufferWritePosition + 4] = " *** *** ";
      buffer[bufferWritePosition + 5] = " **   ** ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'Y':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "     *** ";
      buffer[bufferWritePosition + 1] = "    **** ";
      buffer[bufferWritePosition + 2] = " ****    ";
      buffer[bufferWritePosition + 3] = " ****    ";
      buffer[bufferWritePosition + 4] = "    **** ";
      buffer[bufferWritePosition + 5] = "     *** ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case 'Z':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = " **    * ";
      buffer[bufferWritePosition + 1] = " ***   * ";
      buffer[bufferWritePosition + 2] = " * **  * ";
      buffer[bufferWritePosition + 3] = " *  ** * ";
      buffer[bufferWritePosition + 4] = " *   *** ";
      buffer[bufferWritePosition + 5] = " *    ** ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case '.':
    if (thereAreEnoughSlots(3)) {
      buffer[bufferWritePosition + 0] = " **      ";
      buffer[bufferWritePosition + 1] = " **      ";
      buffer[bufferWritePosition + 2] = "         ";
      bufferWritePosition += 3;
    }
    break;
  case ',':
    if (thereAreEnoughSlots(4)) {
      buffer[bufferWritePosition + 0] = "*        ";
      buffer[bufferWritePosition + 1] = "***      ";
      buffer[bufferWritePosition + 2] = " **      ";
      buffer[bufferWritePosition + 3] = "         ";
      bufferWritePosition += 4;
    }
    break;
  case '\'':
    if (thereAreEnoughSlots(3)) {
      buffer[bufferWritePosition + 0] = "     *** ";
      buffer[bufferWritePosition + 1] = "     *** ";
      buffer[bufferWritePosition + 2] = "         ";
      bufferWritePosition += 3;
    }
    break;
  case '?':
    if (thereAreEnoughSlots(7)) {
      buffer[bufferWritePosition + 0] = "      *  ";
      buffer[bufferWritePosition + 1] = "      ** ";
      buffer[bufferWritePosition + 2] = " * *   * ";
      buffer[bufferWritePosition + 3] = " * **  * ";
      buffer[bufferWritePosition + 4] = "    **** ";
      buffer[bufferWritePosition + 5] = "     **  ";
      buffer[bufferWritePosition + 6] = "         ";
      bufferWritePosition += 7;
    }
    break;
  case '!':
    if (thereAreEnoughSlots(4)) {
      buffer[bufferWritePosition + 0] = "         ";
      buffer[bufferWritePosition + 1] = " * ***** ";
      buffer[bufferWritePosition + 2] = " * ***** ";
      buffer[bufferWritePosition + 3] = "         ";
      bufferWritePosition += 4;
    }
    break;
  case '-':
    if (thereAreEnoughSlots(4)) {
      buffer[bufferWritePosition + 0] = "   **    ";
      buffer[bufferWritePosition + 1] = "   **    ";
      buffer[bufferWritePosition + 2] = "   **    ";
      buffer[bufferWritePosition + 3] = "         ";
      bufferWritePosition += 4;
    }
    break;
  case ' ':
    if (thereAreEnoughSlots(4)) {
      buffer[bufferWritePosition + 0] = "         ";
      buffer[bufferWritePosition + 1] = "         ";
      buffer[bufferWritePosition + 2] = "         ";
      buffer[bufferWritePosition + 3] = "         ";
      bufferWritePosition += 4;
    }
    break;
  default:
    /*
    if (key == CODED) {
     if (keyCode == UP) {
     timeToWait += 10;
     } 
     else if (keyCode == DOWN &amp;&amp; timeToWait &gt;= 10) {
     timeToWait -= 10;
     if (timeToWait &lt; 0) {
     timeToWait = 0;
     }
     } 
     } 
     break;
     */
  }
}

boolean thereAreEnoughSlots(int slotsRequired) {
  /*
  if((bufferSize - bufferWritePosition) </pre>
]]></description>
   </item>
   <item>
      <title>Is that normal ? (error with strings)</title>
      <link>https://forum.processing.org/two/discussion/18546/is-that-normal-error-with-strings</link>
      <pubDate>Fri, 14 Oct 2016 19:05:43 +0000</pubDate>
      <dc:creator>BPML</dc:creator>
      <guid isPermaLink="false">18546@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I don't understand the problem with the following code. Is that normal ? Please, have someone an answer ?
Thanks !</p>

<p>String text1="A";</p>

<p>String text2="A ...";</p>

<p>String[] text3=split(text2,' ');</p>

<p>String text4=text3[0];// text4= the first part of text2 ="A"</p>

<p>//Printing it, I see it's the same</p>

<p>println(text4); // prints "A"</p>

<p>println(text1); // prints exactly the same</p>

<p>// But...</p>

<p>println(text4==text1);  // say that it wasn't the same; why is "A"(from text1) not "A"(from text4) ??</p>
]]></description>
   </item>
   <item>
      <title>Text from file</title>
      <link>https://forum.processing.org/two/discussion/18488/text-from-file</link>
      <pubDate>Mon, 10 Oct 2016 18:50:22 +0000</pubDate>
      <dc:creator>cookie23</dc:creator>
      <guid isPermaLink="false">18488@/two/discussions</guid>
      <description><![CDATA[<p>I want to tjek if the first letter in the test.txt file is "t". Why does this not work?:</p>

<pre><code>String lines[] = loadStrings("test.txt");
println(lines[0]);

String letter = lines[0].substring(1, 2);
println(letter);

if(letter == "t"){
  print("first letter is t!");
}else{
  print("first letter is not t!");
}
</code></pre>

<p>The console says:</p>

<p>ttt-test<br />
t<br />
first letter is not t!</p>
]]></description>
   </item>
   <item>
      <title>LUBUNTU error opening serial port /dev/ttyS0: Incorrect serial port</title>
      <link>https://forum.processing.org/two/discussion/17512/lubuntu-error-opening-serial-port-dev-ttys0-incorrect-serial-port</link>
      <pubDate>Wed, 13 Jul 2016 12:49:14 +0000</pubDate>
      <dc:creator>ilioSS</dc:creator>
      <guid isPermaLink="false">17512@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I just installed LUBUNTU 16-04 with a running arduino IDE. No problem.</p>

<p>Now I would like to install processing3. I have it running.</p>

<p>But my adxl345 read out in pitch-roll give the above mentioned error.</p>

<p>Already looked on the internet for possible solutions s.a. i must be mention of the group etc.</p>

<p>Al I treid nothing works.</p>

<p>Situation arduino for linux and processing3</p>

<p>linux prog is LUBUNTU 16-04 and linux32 4.4.0.22</p>

<p>Who has the solution. Help is very much apriciated.</p>

<p>Kind regards,</p>

<p>ilioSS</p>

<p>btw arduino uses ttyUSB0  serial port</p>
]]></description>
   </item>
   </channel>
</rss>