Forums » Support

Back To Topics

sbrick programming with javascript - is it possible?

  • July 14, 2017 6:38 PM CEST

    Hi Kristóf Csillag! :)

    I suggest you to take a look to the sbrick.js project: Web Bluetooth works natively in the browser with pure Javascript code. No external frameworks/compilers are needed and this allows you to combine it with other native HTML5/Javascript APIs. Of course not all browsers/devices are supported but it's quite interesting having the same code can running in Chrome for Mac OS or in Android without any change! :D The SBrick Plus support will be improved really soon, but you can already play with it.

    Also the node-sbrick-protocol project is pretty interesting, especially if you wanna develop an App, but are missing some functionalities like the QuickDrive and the SBrick Plus support.

    Both are independent and open source so we can all improve them all together: Jarón Barends is helping me a lot! ^_^

    • 6 posts
    July 14, 2017 2:39 PM CEST
    Hi Kristóf, I would also like the libraries to be made available as soon as possible. I don't care for the lessons either.
    Right now I am playing around with Francisco's library, and that works well. At the moment,the sensor support it still limited, but that may be available shortly. Support for motor, servo and lights is fine. I am very happy to have his code to work with.
  • July 14, 2017 10:27 AM CEST

    [blockquote]Francesco 360fun.net said:

    Hi! I wrote a Javascript library that uses Web Bluetooth: soon I will add also SBrick Plus support! :)

    Please take a look to my project: http://sbrick.360fun.net/

    I'm working a lot on it and soon I will make some videos about the experiments that I'm doing! :D

    [/blockquote]

    There is also this (independent?) library: https://github.com/zkiiito/node-sbrick-protocol

    However, as far as I can tell, netiher of these two libreries offers full functionality, ATM.

    Is there a third (official) library, developed by Vengit, waiting to be released?

    The kickstarter page ( https://www.kickstarter.com/projects/sbrick/connect-code-create-with-sbrick-plus/description ) showcases JS code like this:

    function turn(v) {
        SBrickPlus.drive('B', (v > 90 ? 1 : -1) );
    }

    This seems to suggest that they have something, doesn't it?


    This post was edited by Kristóf Csillag at July 14, 2017 10:28 AM CEST
  • July 13, 2017 11:15 PM CEST

    [blockquote]Balint Mezei said:

    [blockquote]Jarón Barends said:

    Hi Balint,

    Thanks for your quick reply. Do you have an estimation when it will be available?

    [/blockquote]

    Firstly we will release the Swift Playground lessons, it will be ready within a few weeks expectedly, an our NXT/EV3 adapters will be shipped soon. 

    At the moment these steps are the next. Later on, the Javascript lessons will be released too, but we need some time. :) 

    We do our best, but we don't know the exact date. 

    We ask for your patience. Thank you! 

    Balint
    SBrick Team

    [/blockquote]

    Hi, I am also interested in this.

    However, for a starter, I don't necessarily need lessions; I would be already satisfied if I could get my hands on the required libraries to control the SBrick from the browser. Would you consider releasing that, independently of the planned lession plan?

    Thank you.

       Kristof

  • June 22, 2017 12:48 PM CEST

    That's great! :D I'm happy that somebody start to use the code! ^_^ I have an important update to make to add SBrick Plus support and multiple SBrick management! ;) As soon as I have time I will push it, just careful because it will break your code! :P

    Feel free to contact me at francesco@360fun.net

    • 6 posts
    June 17, 2017 8:07 PM CEST

    Hi Francesco, I've got it working on an Android phone in my office. If al goes well, I will be able to borrow an Android device so I can continue at home :)

    Right now I'm trying to make a very basic control, just to check out how stuff works (at the moment I've put it up on my github page, https://jaronbarends.github.io/index.html, but I will move it later). I do have some technical questions about how to use your library, and about your implementation of promises, but I think it will send you an email about that. I'll keep you posted!

  • June 3, 2017 2:33 PM CEST
    Google is working on Windows support, hopefully it will come in the next months. iOS is pretty hard...but let's hope!
    I'll wait for your feedback! ;)
    This post was edited by Francesco 360fun.net at June 3, 2017 2:33 PM CEST
    • 6 posts
    June 3, 2017 11:46 AM CEST

    Unfortunately, I only have a windows 10 machine, an iPhone and a tablet that runs Android 4.4 with no possibility to upgrade :(

    At my office we do have some testing devices, so I'll take my SBrick there and see if I can get stuff to be detected. I'll keep you updated...

  • June 3, 2017 1:17 AM CEST

    Happy that you like it, now let's make it working! :)

    Right now the Web Bluetooth API works fully only in Mac OS, Linux and Android 6 with the latest version of Google Chrome, so be sure that you have everything updated!

    SBrick.connect() can work also without parameters, tecnically should show you all the Bluetooth devices around you. Since I also got problems in this part, if it doesn't work try to pass the name of your SBrick:

    SBrick.connect("SBrick"); // by default is "SBrick"

    If the name is "SBrick2" or something similar, it will show up anyway because is part of the string.

    The SBrick must be without password and not connected already with other devices.

    Let me know if you solve it: feedbacks like these help me to improve the code and the user experience! :)

    • 6 posts
    June 2, 2017 9:29 PM CEST

    Hi Francesco, Thanks for your response. I've taken a look at your library, and it looks really promising! However, I can't seem to be able to detect my sbrick :(

    To keep things as basic as possible, I have simply created a button that calls SBRICK.connect when it is clicked. The browser's connection window appears, but after scanning for some time it says "No bluetooth devices found". When I use the SBrick Driver app, that that app does detect the SBrick.

    To me, this seems to be an issue between the SBrick and the bluetooth web API, but I was hoping you have an idea what's going wrong?

  • June 1, 2017 7:45 PM CEST

    Hi! I wrote a Javascript library that uses Web Bluetooth: soon I will add also SBrick Plus support! :)

    Please take a look to my project: http://sbrick.360fun.net/

    I'm working a lot on it and soon I will make some videos about the experiments that I'm doing! :D

    • 310 posts
    May 19, 2017 11:00 AM CEST

    [blockquote]Jarón Barends said:

    Hi Balint,

    Thanks for your quick reply. Do you have an estimation when it will be available?

    [/blockquote]

    Firstly we will release the Swift Playground lessons, it will be ready within a few weeks expectedly, an our NXT/EV3 adapters will be shipped soon. 

    At the moment these steps are the next. Later on, the Javascript lessons will be released too, but we need some time. :) 

    We do our best, but we don't know the exact date. 

    We ask for your patience. Thank you! 

    Balint
    SBrick Team

    • 6 posts
    May 18, 2017 4:13 PM CEST

    Hi Balint,

    Thanks for your quick reply. Do you have an estimation when it will be available?

    • 310 posts
    May 18, 2017 1:50 PM CEST

    [blockquote]Jarón Barends said:

    Hi, I just purchased an SbrickPlus because the kickstarter page said it's possible to program it with javascript. However, I can't find any documentation on it, which makes me wonder if this is even possible at the moment. I would be very disappointed if it isn't. Does anyone know?

    [/blockquote]

    Dear Jarón, 

    Thank you for your message! 

    We are working on the Javascript lessons, but they are under progress yet. 

    We have a little delay with creating the lessons, but we are working on it as hard as we can. 

    We ask for your patience. :) 

    Thank you! 

    Have a nice day,

    Balint
    SBrick Team

    • 6 posts
    May 17, 2017 8:19 PM CEST

    Hi, I just purchased an SbrickPlus because the kickstarter page said it's possible to program it with javascript. However, I can't find any documentation on it, which makes me wonder if this is even possible at the moment. I would be very disappointed if it isn't. Does anyone know?