Avatar for HaraldK

HaraldK

Member since Sep 2015 • Last active Feb 2021
  • 7 conversations
  • 23 comments

Most recent activity

  • in ESP32
    Avatar for HaraldK

    Thanks for the quick reply Gordon!
    And yes, setup is done:

    I2C1.setup({scl: D22, sda: D21, bitrate: 400000});
    I2C1.writeTo(0x56, [0, 100, 0]);    // the 2 is not needed as it's the length of the data
    

    Tried with [] and without, with 100 and 400 kbit/s

    I cannot change the pins. I can see/detect the slave Mega328. I2C1 works for everything I throw at. I think I'm missing something to make the Lego+ module "start" somehow.
    My hope is someone uses a M5Stack module and loves using Espruino on it too.

    • 3 comments
    • 236 views
  • in ESP32
    Avatar for HaraldK

    Hi,

    I got a M5Stack thing with several I2C sensors. All work with Espruino. Awesome!
    I got a LEGO+ module (AKA DC Motor) which can control Lego motors from the Mindstorm series. It works using M5Stack's microPython. Capabilities are limited to turn motor to speed -255..255 and read the encoder absolute values. The actual logic is handled by a Atmel Mega328. Here an example how you talk to it via Arduino code.

    It behaves as a I2C slave device (addr 0x56), but I cannot make it work using Espruino.

    M5Stack has has several similar modules with on-board controller and I assume the way to talk to them is similar.
    Does anyone have an example of talking to those M5Stack modules which are I2C slave devices? Any of them?

    This code does not work:

    I2C1.writeTo(0x56, 0, 100, 0, 2);
    

    which is (supposedly) matching line 43 of the LEGO_PLUS.ino sample code.
    What am I missing?

    • 4 comments
    • 763 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for HaraldK

    Thanks! I'll heed Gordon's suggestion and use BLE instead then. Especially since Conor didn't work on ANT either.
    Works for me. Thanks to both of you for the very quick reply!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for HaraldK

    Hi,

    I got 2 Puck's and a Garmin smartwatch. Both can use BLE as well as ANT. There are unfortunately no examples for ANT or ANT+.

    Does Espruino support ANT or ANT+ in any way?

    If not, I'll have to go the BLE route it seems.

    Harald

  • in ESP8266
    Avatar for HaraldK

    Nothing else running on it. I had more, but to debug this problem I removed anything else (not that much was running since it's very much space constrained).
    Since the point is to display whatever is sent (up to 6 bytes, since it's a 6 character display), not much chopping up possible.
    For power: It's using a USB power adapter. Never had problems with it.
    Two different ESP8266 modules. Both with ESP12E: Wemos D1mini and a random NodeMCU module.

  • in ESP8266
    Avatar for HaraldK

    Maybe i should simple not use those ESP8266 anymore...

    ESP32 tested and works 100% as expected.

    BTW in both cases I use v2.0x (x=0 for ESP32, x=1 for ESP8266).

  • in ESP8266
    Avatar for HaraldK

    Hi,

    I have a small ESP8266 module which is supposed to receive simple data via simple TCP. The net module should do that and it works mostly:

    var server = net.createServer(function(socket) {
      socket.on('data', function(data) {
        try {
          let a=JSON.parse(data);
          console.log(">"+JSON.stringify(a));
        } catch(e) {
          console.log("ERROR: ", e);
        }
      });
      socket.end();
    });
    
    server.listen(1234);
    

    On the sender side I do a simple test via netcat:

    for i in {0..4} ; do echo "{'toggle':$i}" | nc 192.168.21.105 1234 ; done
    

    But what I get on the Espruino side is:

    {"toggle":0}
    {"toggle":2}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":1}
    {"toggle":2}
    {"toggle":3}
    {"toggle":4}

    which is not what I'd expect from TCP. I should see 0, 1, 2, 3, 4.
    Even if I send one string at a time (and not 5 in a loop), it gets lost in about 20% of the cases.

    Am I doing something wrong? Is the net module on ESP8266 not working reliably?

Actions