Arduino digitalread "run down" effect problem

edited January 2015 in Questions about Code
import processing.serial.*;

import cc.arduino.*;

Arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

void setup() {
  size(470, 200);

  println(Arduino.list());

  arduino = new Arduino(this, Arduino.list()[1], 57600);

  arduino.pinMode(3, Arduino.OUTPUT);

  arduino.pinMode(5, Arduino.INPUT);
  arduino.pinMode(6, Arduino.INPUT);
  arduino.pinMode(7, Arduino.INPUT);
  arduino.pinMode(8, Arduino.INPUT);
  arduino.pinMode(9, Arduino.INPUT);
  arduino.pinMode(10, Arduino.INPUT);
  arduino.pinMode(11, Arduino.INPUT);
  arduino.pinMode(12, Arduino.INPUT);
}

void draw() {
  background(off);
  stroke(on);

  arduino.digitalWrite(3, Arduino.HIGH);

  for (int i = 5; i <= 12; i++) {
    if (arduino.digitalRead(i) == Arduino.HIGH)
      fill(on);
    else
      fill(off);

    rect(420 - i * 30, 30, 20, 20);
  }
}

For example : Im connecting the pin 3 with the pin 5. It turn on fast. But then im disconnecting the pins it turn off slowly with some delay. And blinking like "run down" effect. Why ? How i can correct that ? I need to turn off it fast like turning on.

I have Arduino Duemilanove (ATmega328). Power with the usb.

PS sorry for my bad english

Tagged:
Sign In or Register to comment.