Skip to content

deshan-nawanjana/uno.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uno.js - JavaScript Library for Arduino

Integrate Arduino technology into JavaScript is the main concept of uno.js. This library communicate with the microcontroller that has connected to your PC and reads values from sensors and modules to do any kind of calculation in web environment.

Installation

To use uno.js properly, you have to install uno.js client program to your microcontroller first. Read this page of the documentation to upload now or select suitable HEX file and flash it by yourself. Once you have succesfully installed the client application, there is no requirement of installing anything to your Arduino microcontroller otherwise if you change your uno.js version.

Then download the latest version of uno.js library using this link and attach to your web application.

<script src="path/to/file/uno.min.js"></script>

First Program

Let's blink an LED using uno.js.

// create controller
const myBoard = new UNO.Controller()

// blink function
const blink = async function() {
    // init controller
    await myBoard.init()
    // set pin mode
    await myBoard.pinMode(13, OUTPUT)
    // loop forever
    while(true) {
        // turn on led and delay
        await myBoard.digitalWrite(13, HIGH)
        await myBoard.delay(300)
        // turn off led and delay
        await myBoard.digitalWrite(13, LOW)
        await myBoard.delay(200)
    }
}

// click on window to start
window.addEventListener('click', blink)

Documentation

Read uno.js documentation to undrstand the library quickly. Each page of the documentation contains a program to test. Threfore, connect your microcontroller that has uploaded the client app and continue.

Developed by Deshan Nawanjana

DNJS  |  LinkedIn  |  GitHub  |  YouTube  |  Blogger  |  Facebook  |  Gmail