Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. PocketDonkey
    P
    • Continue chat with PocketDonkey
    • Start new chat with PocketDonkey
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    PocketDonkey

    @PocketDonkey

    0
    Reputation
    6
    Posts
    37
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    PocketDonkey Follow

    Posts made by PocketDonkey

    • RE: M5Stick with both Hat and Grove

      Thanks for the reply @crami25

      Unfortunately I have already purchased the Hats and Grove sensors and have a physical hardware setup that utilizes the Hat positioning relative to how I am mounting the M5Stick.

      The easiest way would be:

      Might there be a harder way that allows me to use the M5stack hardware I have on hand? ;)

      What is strange about all of this to me is that using UIFlow and this exact hardware it works with:
      ToF1 = hat.get(hat.TOF)
      ToF2 = unit.get(unit.TOF, unit.PORTA)
      IMU = IMU()

      posted in Arduino
      P
      PocketDonkey
    • M5Stick with both Hat and Grove

      Hello,

      I am trying to use an M5StickC plus with a hat sensor (TOF), a grove sensor (TOF), and the internal IMU. Using the code below I’m able to get data from both the Hat and Grove sensors running using Wire1. However, the IMU no longer functions with the Wire1.begin call as written.

      I’m new to Arduino. Is there a better way to get both Hat and Grove working simultaneously that avoids the need for Wire1? Any ideas on how to get this trio of sensors up and running?

      FWIW I had originally prototyped this in micropython and had all three sensors working; latency was killer however and arduino is much much faster (like > 10x).

      Thx, PD

      #include <VL53L0X.h>
      #include <Wire.h>
      #include <M5StickCPlus.h>

      VL53L0X sensor;
      VL53L0X sensor2;

      void setup() {
      Wire.begin(0, 26, 100000UL); // for I2C of HAT connection
      Wire1.begin(32, 33, 100000UL); // for I2C of grove connection

      M5.begin(); // starts serial 115200

      sensor.setTimeout(500);
      while (!sensor.init()) {
      Serial.println("Failed to detect and initialize sensor!");
      delay(250);
      }
      sensor.startContinuous();

      sensor2.setBus(&Wire1);
      sensor2.setTimeout(500);
      while (!sensor2.init()) {
      Serial.println("Failed to detect and initialize sensor2!");
      delay(250);
      }
      sensor2.startContinuous();

      delay(100);
      int IMUinit = M5.IMU.Init();
      Serial.print("IMU init return val: ");
      Serial.print(IMUinit); // <- -1 means it's not working..
      Serial.println();
      }

      void loop() {
      uint16_t distance1 = sensor.readRangeContinuousMillimeters();
      uint16_t distance2 = sensor2.readRangeContinuousMillimeters();
      Serial.print(distance1);
      Serial.print(" ");
      Serial.print(distance2);

      if (sensor2.timeoutOccurred()) {
      Serial.print(" TIMEOUT");
      }
      Serial.println();
      }

      posted in Arduino
      P
      PocketDonkey
    • RE: Arduino get_apikey()

      @holofloh Thanks, this is exactly what I was looking for. PD

      posted in SOFTWARE
      P
      PocketDonkey
    • RE: Arduino get_apikey()

      Thanks @ajb2k3. Do you happen to know if there is any way to obtain a char[] or int that is unique to each M5stickC in Arduino? If one has many devices sending data over wifi, is there any way to tell them apart other than hardcoding a string or using a hardcoded IP address? Cheers, PD

      posted in SOFTWARE
      P
      PocketDonkey
    • Arduino get_apikey()

      Hello,

      I am working with an M5StickCplus.

      In micropython one can obtain a unique device ID like this:

      import deviceCfg
      deviceCfg.get_apikey()

      How does one get this same key in Arduino? Is this only a feature of UIFlow or is there some equivalent other hex identifier?

      Thx, PD

      posted in SOFTWARE
      P
      PocketDonkey