You are reading a single comment by @Abhigkar and its replies. Click here to read the full conversation.
  • Thanks @Gordon for your suggestions. I will try it for sure. Since there is already Arduino library available, will it be worth to try to add the C code in Espruino src as a lib and compile it locally? As you are doing with microbit, hexbadge and BangleJS as a same way add my C code in lib folder and compile?

    Another question, what will happen if there is an un-handled exception in Espruino? A restart/reset?

    To get some ideas, look at the Espruino event object.

    @allObjects, As I am exploring all available option, I would like to know where I can fine re information about is Espruino event object?

  • Since there is already Arduino library available, will it be worth to try to add the C code in Espruino src as a lib and compile it locally?

    If it is worth to you then go on. However arduino (C++) code and Espruino C code can be quite different so it may not be trivial to port arduino library to espruino. C module is necessity if you cannot do it in JS (no JS api exposed) or for performance reasons. However you lose the modularity. Anyone using same sensor would need to build own espruino version. If you do it as JS module the code can be put here https://www.espruino.com/modules/ and people can use it without custom Espruino build.

  • Tue 2020.04.14

    'where I can fine re information about is Espruino event object'

    The reference made in post #10 is to the detail provided once the watch fires. The easiest way to see what is available is to create a new var inside the watch and assign 'e' to that var, then follow that with the 'debugger' command. Fire the watch. Attempting to just write to the console will result in [object Object]

    The return property set is described in the second to last full pp beneath the description heading.

    https://www.espruino.com/Reference#l__gl­obal_setWatch



    In the off chance that comment was a reference to Espruinos 'E' class as there are a few events within it:

    Search 'E Class' or nav on left-hand side 'E'

    https://www.espruino.com/Reference#t_E
    https://www.espruino.com/Reference#t_l_E­_errorFlag
    https://www.espruino.com/Reference#t_l_E­_init


    'what will happen if there is an un-handled exception in Espruino'

    when within the user JS code and not from within the underlying C source
    Typically nothing out of the ordinary. Where necessary, I wrap internal function code sections with try/catch blocks and throw my own exceptions. Gordon provided this nice snippet that may help, regarding assertions:

    post #6 and #7 How to determine which setWatch callback

About

Avatar for Abhigkar @Abhigkar started