Go Down

Topic: "Dimmer" noob question (Read 2 times) previous topic - next topic

PaulS

I don't know what to tell you. I started Processing and the Arduino IDE. I pasted your two sketches into the appropriate windows. I uploaded the code to the Arduino, and ran the Processing sketch. When I move the mouse back and forth in the little window that Processing posts, my LED gets brighter and dimmer.

I did confirm that the Processing sketch is sending a byte.

Soffer

First of all thanks for checking this out.
This must mean physical connection is wrong.
I'm going over everything again.  :smiley-slim:

Soffer

This is really weird.
Still nothing.
I have a message stating

"Display 0 does not exist, using the default display instead."

But from reading the various Processing forums this seems redundant...

Soffer

Fixed the "Display 0 does not exist..." by editing prefernces.
Still nothing

Soffer

PaulS, read one of your comments here http://arduino.cc/forum/index.php/topic,40414.0.html

And so added this in the arduino sketch:
Code: [Select]
if (Serial.available()) {
    // read the most recent byte (which will be from 0 to 255):
    brightness = Serial.read();
    Serial.print (brightness);  //this was added now to check data w/o openineg serial monitor
    // set the brightness of the LED:
    analogWrite(ledPin, brightness);
  }


and this in processing sketch:
Code: [Select]
// write the current X-position of the mouse to the serial port as
// a single byte
port.write(mouseX);
println (port.readString());


I get "null" repeatedly.

Go Up