[Runkit]Make temperature api

Connet analog sensor LM35 to obniz.

The code is a little change from [Runkit]Use webhook.

We make the api which response is this.

  "status" : "success",
  "temperature" : 25.3

If your obniz is offline, reponse is this.

  "status" : "failed",
  "error" : "Cannot connect to obniz."

Let's make code.

// Runkit Endpoint Example

const Obniz = require("obniz");
const express = require("@runkit/runkit/express-endpoint/1.0.0");
const app = express(exports);

const yourObnizId = "OBNIZ_ID_HERE";  // write your obniz id

app.get("/", async (req, res) => {

    let obniz = new Obniz(yourObnizId);

    let connected = await obniz.connectWait({timeout:10});

      let tempSensor = obniz.wired('LM35', { gnd: 0, output: 1, vcc: 2 });
      await obniz.wait(100); //wait for stabilizing
      let temp = await tempSensor.getWait();

      req.json({ status: "success", temprature : temp});
       req.json({ status: "failed", error : "Caonnot connect to obniz."});


Please access your endpoint.

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers


Visit our developer’s forum to discuss and discover technologies.



Feel free to contact out support and technical team.

Contact us