GithubHelp home page GithubHelp logo

alf0ns0-l0pez / minerpunk_serial_webapi Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.61 MB

Serial Web Api is a web service code developed to gave web access to multiples serial ports which are connect to The MinerPunk Boards and so through web requests handle peripherals

License: MIT License

Python 100.00%
data-acquisition flask insomnia-rest pyserial python webapi

minerpunk_serial_webapi's Introduction

MINER PUNK - Serial Web Api

logo

Introduction

Serial Web Api is a web service code developed to gave web access to multiples serial ports which are connect to The MinerPunk Boards and so through web requests handle peripherals.

Dependencies

You can take a look in the file requirements.txt which is attached in this project to know every library used in this App.

To install in a virtual environment in your current project:

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

Setup

There is a file named startup.yaml where the main settings are located, the following are the most important parameters:

  • Ip Address and Port.
    #Web server setup
    app:
        ipaddr: 'localhost'
        port: 9000
  • It is necessary to add every serial port that our boards are using in the next list, Note. do not add ports that we are not using!.
    serialport:
        timeout : 5
        baudrate : 115200
        ports :
          - 'COM6' #Board 1
          - 'COM7' #Board 2

Usage Example

Python Example:

If you wish to test it, there is an example named example/app_test.py which makes a request to one of our web apis http://localhost:9000/get_complete and returns the next.

{
	"data": {
		"description": {
			"BOARD": "RELAY_MATRIX",
			"SUPPLIER": "MINERPUNK",
			"VERSION": "1.1"
		},
		"inputs": {
			"INP_OPT1": false,
			"INP_OPT2": false,
			"INP_OPT3": false,
			"INP_OPT4": false
		},
		"outputs": {
			"OUT_REL1": false,
			"OUT_REL2": true,
			"OUT_REL3": true,
			"OUT_REL4": false,
			"OUT_REL5": true,
			"OUT_REL6": false,
			"OUT_REL7": true,
			"OUT_REL8": true
		},
		"receive": [],
		"status": true
	},
	"status": true
}

Using Insomnia:

This Repository counts with a Request Collection, using this tool you be able to interact with the Web Apis.

  • First of all, Insomia installed is required, DOWNLOAD PAGE
  • Then import the file Insomnia.json to open our Request Collection.
  • Now you can test each of our Web Apis.

Example Gif

insomnia_example

Compatible Boards

  1. MinerPunk_RelayMatrix_USB

minerpunk_serial_webapi's People

Contributors

alf0ns0-l0pez avatar

Watchers

 avatar

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.