Search wiring.org.co:

Libraries \ FirmataProcessing

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Class | Wiring
Name |

### digitalRead()

Examples |
    import processing.serial.*; //Import the Serial i/o and the Wiring Libraries
    import Wiring.*;
    Wiring wiring; //Create a Wiring object

    int inpin = 0;
    int outpin = 1;
    int val = 0;

    void setup() {
      println(Wiring.list()); //print the serial devices list
      wiring = new Wiring ( this, Wiring.list()[1], 57600); //inicialized the wiring object

      Wiring.pinMode(inpin, Wiring.INPUT);
      Wiring.pinMode(outpin, Wiring.OUTPUT);
    }

    void draw() {
      val = Wiring.digitalRead(inpin);
      if (val == Wiring.HIGH)
      {
        Wiring.digitalWrite(outpin, Wiring.HIGH);
      }
      else {
        Wiring.digitalWrite(outpin, Wiring.LOW);
      }
    }
Description | The digitalRead() method reads the value of a digital input pin.
Syntax |
    Wiring.digitalRead(pin)
Parameters |

pin | HIGH or LOW.

Returns | int
Usage | Application

Updated on July 07, 2011 11:10:10pm PDT