Avatar for mkol5222


Member since Jun 2018 • Last active Jun 2019
  • 1 conversations

Most recent activity

  • in Porting to new Devices
    Avatar for mkol5222

    @Gordon I love flexibility of Espruino and how PuckJS enabled me to explore various scenarios. However next education and PoC goal for me would be mesh networks like BlueTooth Mesh and (Open)Thread.

    Are you getting closer to releasing nRF52840 (MDBT50Q?) board and bringing Nordic nRF mesh SDK features to Espruino JavaScript world, please?

  • in Interfacing
    Avatar for mkol5222

    @Gordon and @Wilberforce Many thanks for quick response. Suggestion to use new setWatch functionality for reading data pin exactly resolved timing issues with data readings.

    I am amazed how Puck.JS and Espruino JavaScript approach makes prototyping so easy including making easy publishing of data via BLE GATT service. We have submitted order for additional Espruino gatgets to learn even more.

  • in Interfacing
    Avatar for mkol5222

    I am trying to port Arduino C code to Puck.JS JavaScript
    and I think I have potential timing issue with use of setWatch on clock PIN
    to read data from data PIN similar to code below.

    Is it possible to find optimal solution to interpret my input PINs
    even with setWatch callback?
    I do not get consistent results reading the data and I am worried that
    only solution would be to have native code handling it?

    What I try to do - storing each data bit on clock edge to array (to be interpreted later)

    var req = 31; //mic REQ
    var dat = 1; //mic Data line
    var clk = 2; //mic Clock line
    var i = 0;
    var a=[];
    pinMode(clk, 'input_pullup');
    pinMode(dat, 'input_pullup');
    pinMode(clk, 'input_pullup');
    setWatch(function () {
            b = digitalRead(dat);
            if (i < 52) {
    }, clk, {
        edge: "rising",
        debounce: 0,
        repeat: true

    Arduino code was similar to
    Arduino is using loop driven by CLK pin vs. Espruino based on JavaScript callback with set Watch for CLK edge...
    My HW is Puck.JS.

    void loop()
        digitalWrite(req, HIGH); // generate set request
        for (i = 0; i < 13; i++)
            k = 0;
            for (j = 0; j < 4; j++)
                while (digitalRead(clk) == LOW) {}
                while (digitalRead(clk) == HIGH) {}
                bitWrite(k, j, (digitalRead(dat) & 0x1)); // read data bits, and reverse order )
            mydata[i] = k;