Navigation

    M5Stack Community

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

    benalb

    @benalb

    1
    Reputation
    10
    Posts
    952
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    benalb Follow

    Posts made by benalb

    • RE: MQTT data transmission

      Is the expected behavior from the server, keep the last received value.

      posted in SOFTWARE
      B
      benalb
    • RE: drawRoundRect ...GREY doesn't work

      @stoni99 I think you must use DARKGREY or LIGHTGREY.
      see this

      posted in Arduino
      B
      benalb
    • RE: Unit Cam greyed out on UiFlow -- Core2 and StickC Plus

      @creakygate same here, also greyed for atoms. No solution that I know.

      posted in UIFlow
      B
      benalb
    • atom matrix, wrong number of leds.

      With this code:

      #include <M5Atom.h>
      
      void setup(){
             M5.begin(true, false, true);    //Initialize M5Atom. 
             delay(50);   //Delayed 50ms. 
             M5.dis.fillpix(0xFFFFFF);
             delay(10000);
             M5.dis.clear();
      }
      
      void loop(){
      }
      

      I've got 24 leds on, the last one off , but if I change the
      #define NUM_LEDS 25 to 26 in
      .pio/libdeps/m5stack-atom/M5Atom/src/utility/LED_DisPlay.h
      I've got 25 leds on
      Is it a known bug in the atom lib?

      posted in Atom
      B
      benalb
    • RE: MicroPython on M5Stamp-C3

      @mlindholm would you share the link to that blog post?. Thanks.

      posted in Micropython
      B
      benalb
    • RE: Using atom-mate with cback-driver.

      @felmue thanks, now it compiles and uploads to the atom. But it does not work. I have also changed the ports in CBACK_DRIVER.cpp to match the ones of the atom-mate, from

      Wire.begin(0, 26);
      

      to

      Wire.begin(19,22);
      

      but no luck.

      posted in Atom
      B
      benalb
    • Using atom-mate with cback-driver.

      I¡m trying to run a couple of servos with atom lite, using the atom-mate and the cback-driver for m5stick. Using platformio, I've copied CBACK_DRIVER.h and CBACK_DRIVER.cpp to the include dir in the project, modified the obvious #include <M5Atom.h>, and with this code:

      #include <M5Atom.h>
      #include "CBACK_DRIVER.h"
      
      bool flag = true;
      
      CBACK_DRIVER Driver;
      int C_BLACK = 0x000000;
      int C_WHITE = 0xffffff;
      int C_RED = 0xff0000;
      int C_GREEN = 0x00ff00;
      int C_BLUE = 0x0000ff;
      
      
      void setup() {
              M5.begin(true, false, true);
              // let's check the atom is ok
              delay(50);
              M5.dis.drawpix(0, C_GREEN); // green
              delay(1000);
              M5.dis.drawpix(0, C_BLACK); // black
              Serial.begin(115200);
                      Driver.Init();
                      delay(1000);
                      Serial.println("C Back Driver Test...");
      
      }
      void loop() {
              if(M5.Btn.wasPressed()){
                      flag = !flag;
                      Serial.println("toggle flag value");
              }
              if(flag){
                      for(int i=1; i<=4;i++){
                              Driver.SetServoAngle(i,90);
                              Serial.println("servo 90");
                              // Driver.ReadServoPulse(i,1500);
                      }
                      Driver.SetOutput(1);
              }else{
                      for(int i=1; i<=4;i++){
                              Driver.SetServoAngle(i,120);
                              Serial.println("servo 120");
                              // Driver.ReadServoPulse(i,2000);
                      }
                      Driver.SetOutput(0);
              }
              Serial.print("PortB ADC: ");
              Serial.println(Driver.ReadADC());
              M5.update();
      }
      

      I get this error:

      Building in release mode
      Linking .pio/build/m5stack-atom/firmware.elf
      .pio/build/m5stack-atom/src/main.cpp.o:(.literal._Z5setupv+0x2c): undefined reference to `CBACK_DRIVER::Init()'
      .pio/build/m5stack-atom/src/main.cpp.o:(.literal._Z4loopv+0x18): undefined reference to `CBACK_DRIVER::SetServoAngle(unsigned char, unsigned char)'
      .pio/build/m5stack-atom/src/main.cpp.o:(.literal._Z4loopv+0x1c): undefined reference to `CBACK_DRIVER::SetOutput(unsigned char)'
      .pio/build/m5stack-atom/src/main.cpp.o:(.literal._Z4loopv+0x20): undefined reference to `CBACK_DRIVER::ReadADC()'
      .pio/build/m5stack-atom/src/main.cpp.o: In function `setup()':
      /home/benalb/Projects/m5atom/cback/src/main.cpp:22: undefined reference to `CBACK_DRIVER::Init()'
      .pio/build/m5stack-atom/src/main.cpp.o: In function `loop()':
      /home/benalb/Projects/m5atom/cback/src/main.cpp:36: undefined reference to `CBACK_DRIVER::SetServoAngle(unsigned char, unsigned char)'
      /home/benalb/Projects/m5atom/cback/src/main.cpp:40: undefined reference to `CBACK_DRIVER::SetServoAngle(unsigned char, unsigned char)'
      /home/benalb/Projects/m5atom/cback/src/main.cpp:44: undefined reference to `CBACK_DRIVER::SetOutput(unsigned char)'
      /home/benalb/Projects/m5atom/cback/src/main.cpp:47: undefined reference to `CBACK_DRIVER::ReadADC()'
      collect2: error: ld returned 1 exit status
      *** [.pio/build/m5stack-atom/firmware.elf] Error 1
      ========================================================= [FAILED] Took 13.90 seconds =========================================================
      
      

      any ideas?

      posted in Atom
      B
      benalb
    • RE: StickC reboots when sending message via esp-now. [solved]

      @felmue Thank you very much for the solution and the explanation. It now works,

      posted in M5 Stick/StickC
      B
      benalb
    • StickC reboots when sending message via esp-now. [solved]

      As the subject says, I have copied the example code for esp-now on esp32 from randomnerdtutorials to comunicate a stickC with an Atom Lite. If the atom is off,the code works ok, but if the atom is on, the message is sent once, and then, the stickC reboots, in a loop, send message, reboot, send message, reboot.

      /*
       * based on https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/
       */
      #include <M5StickC.h>
      #include <WiFi.h>
      #include <esp_now.h>
      
      // wifi settings
      const char* ssid = "cositas_electronicas";
      
      IPAddress local_IP(192, 168, 0, 101);
      IPAddress gateway(192, 168, 0, 1);
      IPAddress subnet(255, 255, 0, 0);
      IPAddress primaryDNS(1, 1, 1, 1);   //optional
      IPAddress secondaryDNS(9, 9, 9, 9); //optional
      
      // esp now
      // receiver mac address
      uint8_t broadcastAddress[] = {0x24, 0xA1, 0x60, 0x46, 0xF1, 0x70};
      
      // structure to send data, must match receiver structure
      typedef struct struct_message {
              char a[32];
              int b;
      } struct_message;
      
      // create a struct_message called myData
      struct_message myData;
      
      // callback when data is sent
      void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
              M5.Lcd.fillScreen(BLACK);
              M5.Lcd.setCursor(0, 20);
              M5.Lcd.println("Last Pkg send status");
              M5.Lcd.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
      }
      void setup() {
              M5.begin();
              Serial.begin(115200);
              Serial.println("starting....");
      
              WiFi.mode(WIFI_AP_STA);
              // Configures static IP address
              if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
                      Serial.println("STA Failed to configure");
              }
      
              // Connect to Wi-Fi network with SSID
              M5.Lcd.fillScreen(BLACK);
              M5.Lcd.setTextColor(GREEN , BLACK);
              M5.Lcd.setRotation(3);
              M5.Lcd.setCursor(0, 20);
              M5.Lcd.println("Connecting to ");
              M5.Lcd.println(ssid);
              WiFi.begin(ssid);
              while (WiFi.status() != WL_CONNECTED) {
                      delay(500);
                      M5.Lcd.print(".");
              }
      
              // Print local IP address
              M5.Lcd.fillScreen(BLACK);
              M5.Lcd.setCursor(0, 20);
              M5.Lcd.println("WiFi connected.");
              M5.Lcd.println("IP address: ");
              M5.Lcd.println(WiFi.localIP());
              delay(1000);
              M5.Lcd.fillScreen(BLACK);
              Serial.println(WiFi.macAddress());
              // init esp-now
              if (esp_now_init() != ESP_OK) {
                      Serial.println("Error initializing ESP-NOW");
                      return;
              }
              // Once ESPNow is successfully Init, we will register for Send CB to
              // get the status of Trasnmitted packet
              esp_now_register_send_cb(OnDataSent);
      
              // Register peer
              esp_now_peer_info_t peerInfo;
              memcpy(peerInfo.peer_addr, broadcastAddress, 6);
              peerInfo.channel = 0;  
              peerInfo.encrypt = false;
              // Add peer        
              if (esp_now_add_peer(&peerInfo) != ESP_OK) {
                      M5.Lcd.fillScreen(BLACK);
                      M5.Lcd.setCursor(0, 20);
                      M5.Lcd.println("Failed to add peer");
                      return;
              }
      }
      
      void loop() {
              // Set values to send
              strcpy(myData.a, "This is a char");
              myData.b = random(1, 10);
              // Send message via ESP-NOW
              esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &myData, sizeof(myData));
      
              if (result == ESP_OK) {
                      M5.Lcd.fillScreen(BLACK);
                      M5.Lcd.setCursor(0, 20);
                      M5.Lcd.println("Sent with success");
              }
              else {
                      M5.Lcd.fillScreen(BLACK);
                      M5.Lcd.setCursor(0, 20);
                      M5.Lcd.println("Error sending the data");
              }
              delay(2000);
      }
      

      In the serial monitor I get this:

      M5StickC initializing...OK
      starting....
      24:A1:60:45:B2:44
      
      ELF file SHA256: 0000000000000000
      
      Backtrace: 0x40088e68:0x3ffbf810 0x400890e5:0x3ffbf830 0x4012f684:0x3ffbf850 0x40086f65:0x3ffbf870 0x400d1bf8:0x3ffb5830 0x400d26fb:0x3ffb5850 0x4014565d:0x3ffb5880 0x400d06c5:0x3ffb58a0 0x40133f75:0x3ffb58c0 0x401028ef:0x3ffb58e0 0x40104b6e:0x3ffb5910 0x4008a0f6:0x3ffb5940
        #0  0x40088e68:0x3ffbf810 in invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
        #1  0x400890e5:0x3ffbf830 in abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
        #2  0x4012f684:0x3ffbf850 in task_wdt_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/task_wdt.c:252
        #3  0x40086f65:0x3ffbf870 in _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S:1154
        #4  0x400d1bf8:0x3ffb5830 in TFT_eSPI::setWindow(int, int, int, int) at .pio/libdeps/m5stick-c/M5StickC/src/utility/In_eSPI.cpp:5995
        #5  0x400d26fb:0x3ffb5850 in TFT_eSPI::fillRect(int, int, int, int, unsigned int) at .pio/libdeps/m5stick-c/M5StickC/src/utility/In_eSPI.cpp:5995
        #6  0x4014565d:0x3ffb5880 in TFT_eSPI::fillScreen(unsigned int) at .pio/libdeps/m5stick-c/M5StickC/src/utility/In_eSPI.cpp:5995
        #7  0x400d06c5:0x3ffb58a0 in OnDataSent(unsigned char const*, esp_now_send_status_t) at src/main.cpp:32
        #8  0x40133f75:0x3ffb58c0 in esp_now_add_peer at ??:?
        #9  0x401028ef:0x3ffb58e0 in ppProcTxDone at ??:?
        #10 0x40104b6e:0x3ffb5910 in ppTask at ??:?
        #11 0x4008a0f6:0x3ffb5940 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
      
      Rebooting...
      M5StickC initializing...OK
      starting....
      24:A1:60:45:B2:44
      
      

      This happens in two different stickC, using platformio in linux. Any ideas?

      posted in M5 Stick/StickC
      B
      benalb
    • RE: Bluetooth in UI Flow

      @mati It seems it's not available for Sticks and Atoms.

      posted in Features Wish List
      B
      benalb