Avatar for luwar


Member since Nov 2015 • Last active Mar 2018
  • 12 conversations

Most recent activity

  • started
  • in Interfacing
    Avatar for luwar

    Yes, the HTU21D is a SHT2x clone or vice versa.
    Tomorrow I can check the module with a real sensor, but I already think it will work for me. There hasn't been any code change since I last tried it.

    Could you try the other methods? Especially the synchronous variants readTemperature and readHumidity. I'm a little surprised, as the CRC-check didn't show any errors.

    Which board do you use? I tested the module with a Pico.

  • in General
    Avatar for luwar

    I use Espruino with TypeScript and was a bit disappointed at the time that the Typescript goal of the last campaign was not reached.

    So I tried to generated a file espruino.d.ts by myself but gave up. It's seems not possible to generate good TypeScript definitions from the other type files (e.g. espruino.json). There are more informations required than available:

    // This class should be automatically generated.
    class I2C {
            // ...
            readFrom( address: number | { address: number, stop: boolean }, quantity: number ): Uint8Array;

    But the corresponding jswrap comment is

      "type" : "method",
      "class" : "I2C",
      "name" : "readFrom",
      "generate" : "jswrap_i2c_readFrom",
      "params" : [
        ["address","JsVar","The 7 bit address of the device to request bytes from, or an object of the form `{address:12, stop:false}` to send this data without a STOP signal."],
        ["quantity","int32","The number of bytes to request"]
      "return" : ["JsVar","The data that was returned - as a Uint8Array"],
      "return_object" : "Uint8Array"
    Request bytes from the given slave device, and return them as a Uint8Array (packed array of bytes). This is like using Arduino Wire's requestFrom, available and read functions.  Sends a STOP

    The important information of parameter address is only in the description. :-(

    Currently it is required to write the TypeScript type definition by hand but there is always the risk that the type file will become outdated.

    @Gordon: Do you have an idea how it can go on in the long term?

  • in Electronics
    Avatar for luwar

    Breakout board with MAX30100

  • in Interfacing
    Avatar for luwar

    When using the switch you need pin 5 of the rotary too.

    Rotary → Pico
    5 → 3.3V
    3 → B5 (or any other input pin)

    As @ClearMemory041063 mentioned above it is easy to watch a pin:

    // some untested code
    pinMode(B5, "input_pulldown");
    setWatch( function( event ) {
        console.log( event.state ? "Button released" : "Button pressed")
    }, B5, { repeat: true, debounce: 50 });
  • in Interfacing
    Avatar for luwar

    It was stupid from me to use A1 and A2 in the code above. It is hard to wire on the pico. Just use some other pins like B3 and B4.

  • in Interfacing
    Avatar for luwar

    Rotary → Pico
    A → A1
    B → A2
    C → 3.3v

    It is possible that you have to swap A1 and A2. It depends on the detents of the encoder. Then use the sample code of the encoder module:

    var step = 0;
    require("Encoder").connect(A1,A2,functio­n (direction) {
          step += direction;
  • in Puck.js, Pixl.js and MDBT42
    Avatar for luwar

    The senser will raise an event every time when a new measurement is available. There is no sensitivity or the like.

  • in General
    Avatar for luwar

    JavaScript is single-threaded. Busy waiting while (getTime() < t) .. blocks the execution of the setInterval callbacks - and other possible events.

    The segmentation fault is not nice. But the program above is not a useful JavaScript program.

  • in General
    Avatar for luwar

    Are you serious about that? My first thought was: It's a joke. But why on Dec 3rd? May be April Fools' Day in another country? :-)


    Java was used in a variety of things ...

    My two cents to the importance of Java - unrelated to Espruino.
    Java is really dead - running as applet in the browser!
    On the server side it is very popular. The biggest shopping systems, ERP, telecommunication, banking, energy sector applications, .. a majority of the "enterprise" things run on Java.
    By the way the most popular mobile platform is largely built with Java.

    Java and JavaScript are both not common in embedded programming. But latter is changing with Espruino. ;-)