Code Monkey home page Code Monkey logo

Comments (1)

octronic-uk avatar octronic-uk commented on June 20, 2024

Hi @shmick, Thanks I appreciate that :) I'm currently working on adding GPIO scripting capabilities that should allow the application to function as you've described. The implementation will allow you to define 'do', 'while' and 'then' conditions. basically in the following format (pseudo) I'll try to describe it using your application as an example.

And yes state refers to the setting of an IO pin HIGH or LOW.

Do: This will set the states for the relay and an 'opening' warning light (as an example of multiple outputs).

  "do": [
      { 
        "pin": "door_output_relay", 
        state: 1 
      },
      { 
        "pin": "door_warning_light", 
        state 1 
      }
  ]

While: Pause while waiting for a different pin's condition to change - In this case the 'door is open' reed switch. (so far equivalent of 'do ... while (door_open_input == 0)' )

  "while": [
      { 
        "pin": "door_open_input", 
        state: 0
      }
  ]

Then: Apply this state to the specified pins after the while condition is no longer satisfied.

  "then": [
      { 
        "pin": "door_output", 
        state: 0
      },
      { 
        "pin": "door_warning_light", 
        state 0
      }
  ]

Which forms the equivalent of

do:
  set door_output_relay to 1
  set door_warning light to 1
while:
 door_input == 0
then:
  set door_output_relay to 0
  set door_warning_light to 0

This script can be named something like "Open South Door" and triggered from the home screen in a similar way to the existing 'serial commands' section. Also the application's GPIO area can configure a gpio input to indicate the current state of 'door_input' on the home screen.

You will be able to set these scripts up by modifying the config.json file or through the UI in the app's settings page.

Hope this all makes sense :) I wanted to create a solution that kept the application as general-purpose as possible, so let me know if this will accomplish what you wanted.

Ash.

from rpi-web-remote.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.