Coder Social home page Coder Social logo

boltiot-api-godot's Introduction

Boltiot API Wrapper for Godot

Control your Boltiot device from Godot


Godot3

Features

  • Supports all features of Boltiot API Free and Pro plans

Installation

This is a regular plugin for Godot. Copy the contents of addons/boltiot-api into the addons/ folder in the same directory as your project, and activate it in your project settings.

Note: You will need a valid API key from Boltiot Cloud API

Getting Started

  1. After activating the plugin. There will be a new Boltiot node added to Godot. Click on any node in the scene tree for example Root and add the Boltiot node as a child.

  2. Attach a script to the Root node.

extends Node2D

func _ready():
	var bolt = $Boltiot

    # Make sure to keep your API key secret
	bolt.setup("<YOUR_API_KEY>", "<YOUR_DEVICE_ID>")
	
    # Now you can run any of the Bolt API commands
    # Make sure to use yield() on every command
    var response = yield(bolt.digital_read(1), "completed")
    print(response)

Support the Development

Buy Me A Coffee
For queries/suggestions/bugs join Discord server: 3ddelano Cafe


This project is not affiated with Boltiot Cloud or Inventrom Private Limited.


Documentation

Class: Boltiot

Inherits: HTTPRequest
The main Node which interacts with the Boltiot Cloud API

All method other than Boltiot.setup() return a Dictionary with the following keys:

{
    "success": bool,
    ...additional keys like value, data
}

Method other than Boltiot.setup() are async which means you should use yield(method, "completed") in order to get the result.

Methods (Refer to Boltiot API Docs for more details)

Returns Definition Is Async
GPIO Methods
void setup(api_key: String, device_id: String) No
Dictionary digital_write(pin: int, state: bool) Yes
Dictionary digital_multi_write(pins: Array[int], states: Array[bool]) Yes
Dictionary digital_read(pin: int) Yes
Dictionary digital_multi_read(pins: Array[int]) Yes
Dictionary analog_write(pin: int, state: bool) Yes
Dictionary analog_multi_write(pins: Array[int], states: Array[int]) Yes
Dictionary analog_read(pin: String = "A0") Yes
UART Methods
Dictionary serial_begin(baud: int = 9600) Yes
Dictionary serial_write(data: String) Yes
Dictionary serial_read(till?: int) Yes
Dictionary serial_write_read(data: String, till?: int) Yes
Dictionary serial_read(till?: int) Yes
Dictionary serial_read(till?: int) Yes
Utility Methods
Dictionary get_version() Yes
Dictionary get_device_status() Yes
Dictionary get_devices() Yes
Dictionary restart() Yes
Pro Methods
Dictionary servo_write(pin: int, state: bool) Yes
Dictionary servo_multi_write(pins: Array[int], states: Array[bool]) Yes
Dictionary fetch_data() Yes

boltiot-api-godot's People

Contributors

3ddelano avatar

Stargazers

 avatar  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.