Developing extension or device in livemode for arduino uno based board


#1

Hi, I’m trying to develop a new device extension, (or as an extension for arduino uno) to add a device a Colombian company made called the Octabio board, is the board that comes with our STEAM kits, the board can be program as an arduino uno, so the idea was to make blocks for the sensors that comes in the kit (DHT11, Soil humidity, Pump, Motor, Bluetooth, etc.), I read the documentation and started to develop a few blocks that only work on Upload Mode, but on Live Mode, when I try to check things like

await device.isUploadMode()

or

await device.isConnected()

it times out, I tried the live mode for Arduino Uno with this board and it works great, but can seem to make it work with my extensions or devices.

Thanks for your help.


#2

I was getting CORB errors so i tried disabling CORS in chrome running it with --disable-web-security but it keeps getting time out, i will try to log to a web server and run the extension on mblock PC.


#3

It worked! I made a server using express that listen on 55000 and then run fetch with header content-type json and using json middleware on express.

Server code:

const express = require('express')

let app = express()

app.use(express.json())

app.post('',(req, res)=>{
console.log(req.body)
res.status(200).json({"status":"got it!"})
})

app.listen(55000)

Client code:

async afterChangeUploadMode(app, device) {
    fetch('http://localhost:55000', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            "logging": await device.isUploadMode(),
        })
    })
    return true;
}

I get this on console in the server:
{ logging: true }


#4

I will put this as solved, i think using i will be using wiston with a mongo and mongo-express server to log from the mblock PC version, i think to make work my extension on mblock web it needs to be published or some kind of permission has to be given to me.


#5

Hi there:

Very impressive to hear you solve this puzzle by yourself and thank you very much to share your experience to all the user.