Package com.pi4j.io.gpio

Examples of com.pi4j.io.gpio.GpioController


        */
        System.out.println(ANSI_GREEN +"System    Ready");
       
       
        // create gpio controller
        final GpioController gpio = GpioFactory.getInstance();
       
        // provision gpio pin #01 as an output pin and turn on
        final GpioPinDigitalOutput inet_pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, "MyLED", PinState.LOW);
     
          // provision gpio pin #01 as an output pin and turn on
        final GpioPinDigitalOutput run_pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LEDrun", PinState.LOW);
     
       
       
         // provision gpio pin #02 as an input pin with its internal pull down resistor enabled
        final GpioPinDigitalInput exitButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_07, PinPullResistance.PULL_DOWN);

         // provision gpio pin #02 as an input pin with its internal pull down resistor enabled
        final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);

         // provision gpio pin #00 as an input pin with its internal pull down resistor enabled
        final GpioPinDigitalInput myButton2 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_00, PinPullResistance.PULL_DOWN);
  
         // provision gpio pin #03 as an input pin with its internal pull down resistor enabled
        final GpioPinDigitalInput myButton3 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_03, PinPullResistance.PULL_DOWN);
  
       
            // create and register gpio pin listener
        myButton2.addListener(new GpioPinListenerDigital() {

View Full Code Here


    private Thread sensorReadingThread;
    private Webcam webcam;
    private final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
   
    public PiHardwareController() {
        GpioController gpio = GpioFactory.getInstance();
        light = gpio.provisionDigitalOutputPin(LIGHT_PIN, "Light", PinState.LOW);
        light.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF);

        water = gpio.provisionDigitalOutputPin(WATER_PUMP_PIN, "Water", PinState.LOW);
        water.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF);

        fan = gpio.provisionDigitalOutputPin(FAN_PIN, "Fan", PinState.LOW);
        fan.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF);
        startSensorReading();
        initCam();
    }
View Full Code Here

  /**
   * Default constructor.
   */
  public BerryPiWS() {

    GpioController gpio = GpioFactory.getInstance();

    // Set up the pins and set low to start
    System.out.println("Setting up GPIO Pins for output");
    pina = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_07, "Pin A",
        PinState.LOW);
    pinb = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Pin B",
        PinState.LOW);
    pinc = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, "Pin C",
        PinState.LOW);
    pind = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_12, "Pin D",
        PinState.LOW);
    pine = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_13, "Pin E",
        PinState.LOW);
    pinf = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_14, "Pin F",
        PinState.LOW);

  }
View Full Code Here

TOP

Related Classes of com.pi4j.io.gpio.GpioController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.