Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Logo
  1. ioBroker Community Home
  2. Русский
  3. ioBroker
  4. Скрипты
  5. ioBroker скрипты
  6. Управление GPIO

NEWS

  • Wartung am 15.11. – Forum ab 22:00 Uhr nicht erreichbar
    BluefoxB
    Bluefox
    11
    2
    214

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    7.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.7k

Управление GPIO

Управление GPIO

Scheduled Pinned Locked Moved ioBroker скрипты
4 Posts 3 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alekseym6
    wrote on last edited by
    #1

    пример рабочего скрипта

    var gpio = require("gpio");

    var gpioSensDoor = 87;

    var gpioRelLamp1 = 88;

    var gpioSensMotion = 89;

    var gpioRelLamp2 = 94;

    createState('SensDoor','',{type:'boolean',role:'indicator.state',read:true});

    createState('RelLamp1','',{type:'boolean',role:'indicator.state',read:true});

    createState('RelLamp2','',{type:'boolean',role:'indicator.state',read:true});

    createState('SensMotionVestibul','',{type:'boolean',role:'indicator.state',read:true});

    // Calling export with a pin number will export that header and return a gpio header instance

    var gpio87 = gpio.export(gpioSensDoor, {

    // When you export a pin, the default direction is out. This allows you to set

    // the pin value to either LOW or HIGH (3.3V) from your program.

    direction: 'in',

    // set the time interval (ms) between each read when watching for value changes

    // note: this is default to 100, setting value too low will cause high CPU usage

    interval: 100,

    // Due to the asynchronous nature of exporting a header, you may not be able to

    // read or write to the header right away. Place your logic in this ready

    // function to guarantee everything will get fired properly

    ready: function() {

    }

    });

    var gpio88 = gpio.export(gpioRelLamp1, {

    direction: 'out',

    ready: function() {

    }

    });

    var gpio89 = gpio.export(gpioSensMotion, {

    direction: 'in',

    ready: function() {

    }

    });

    var gpio94 = gpio.export(gpioRelLamp2, {

    direction: 'out',

    ready: function() {

    }

    });

    // bind to the "change" event

    gpio87.on("change", function(val) {

    // value will report either 1 or 0 (number) when the value changes

    if ( val == 1 ) {

    setState('SensDoor', true, true);

    } else {

    setState('SensDoor', false, true);

    }

    });

    gpio89.on("change", function(val) {

    // value will report either 1 or 0 (number) when the value changes

    if ( val == 1 ) {

    setState('SensMotionVestibul', true, true);

    } else {

    setState('SensMotionVestibul', false, true);

    }

    });

    on("RelLamp1", function (obj) {

    if ( obj.newState.val == 1 ) {

    gpio88.set();

    } else {

    gpio88.set(0);

    }

    });

    on("RelLamp2", function (obj) {

    if ( obj.newState.val == 1 ) {

    gpio94.set();

    } else {

    gpio94.set(0);

    }

    });

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vtec
      wrote on last edited by
      #2

      Управление gpio это хорошо, но может плату укажите какой управляете?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spectrekr
        wrote on last edited by
        #3

        Угу, а еще желательно от какого пользователя работает IOBroker, и если не от root, то как организовали доступ пользователю к параметрам GPIO.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alekseym6
          wrote on last edited by
          #4

          сечас работает на ODROID X2 и C1+, раньше запускал на Raspberry PI2, Cubieboard. работает от user(не root).

          нужно добавить user в группу gpio

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          Support us

          ioBroker
          Community Adapters
          Donate

          57

          Online

          32.4k

          Users

          81.3k

          Topics

          1.3m

          Posts
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
          ioBroker Community 2014-2025
          logo
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Recent
          • Tags
          • Unread 0
          • Categories
          • Unreplied
          • Popular
          • GitHub
          • Docu
          • Hilfe