Giter VIP home page Giter VIP logo

m5-productexamplecodes's Introduction

M5-ProductExampleCodes

中文 | English | 日本語

此仓库已停止维护,今后产品所对应的示例会单独建仓或在放置在主机仓所对应的例程中,具体位置请看产品文档中的示例程序

M5Stack的所有产品的例程和案例程序都会上传到这个仓库来管理.

你可以在这个仓库中找到很多M5Stack产品相关的例程,参考这些例程之后,你可以更好的开发使用M5的产品。

原理图仓库:

https://github.com/m5stack/M5-Schematic

m5-productexamplecodes's People

Contributors

eeeebin avatar forairaaaaa avatar gitshaoxiang avatar gomihgy avatar graydonli avatar icingtomato avatar icyqwq avatar imliubo avatar kiko62 avatar lin-zi-jun avatar lovyan03 avatar merryq avatar mongonta0716 avatar shashaddd avatar takahashim avatar tchisaka avatar tinyu-zhao avatar vany5921 avatar yellowelise avatar zontex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

m5-productexamplecodes's Issues

Lorawan TTN

Hi

Do you have an example on how to connect the Lorawan Module to the TTN network?

Thanks

ENV code not working

Hi,
just got my ENV unit and wanted to bring it alive with my M5stack and unfortunately it is not working. The example code in Unit/ENV/Arduino/ENV/ENV.ino gives me this:

20:39:16.008 -> M5Stack initializing...OK
20:39:16.650 -> ENV Unit(DHT12 and BMP280) test...
20:39:16.650 -> Could not find a valid BMP280 sensor, check wiring!

When I try my own code on it with following code:

if (!bme.begin(0x76)){  
      Serial.println("Could not find a valid BMP280 sensor, check wiring!");
      while (1);
    }

Then it will work.

PDM I2S config insufficient

To get the PDM sample working, the line

pin_config.mck_io_num = GPIO_NUM_0;

needs to be added after

pin_config.data_in_num = CONFIG_I2S_DATA_IN_PIN;

PDM Unit error compiling

I was unable to compile the PDM unit code

Arduino: 1.8.19 (Windows 10), Board: "M5Stack-Core-ESP32, QIO, 80MHz, Default, 921600, Error"

C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659\sketch_feb11a.ino: In function 'bool InitI2SSpakerOrMic(int)':

C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659\sketch_feb11a.ino:43:29: warning: 'I2S_COMM_FORMAT_I2S' is deprecated [-Wdeprecated-declarations]

 .communication_format = I2S_COMM_FORMAT_I2S,  // Set the format of the communication.  设置通讯格式

                         ^~~~~~~~~~~~~~~~~~~

In file included from C:\Users\andre\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.2/tools/sdk/esp32/include/driver/include/driver/i2s.h:16,

             from C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659\sketch_feb11a.ino:19:

C:\Users\andre\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.2/tools/sdk/esp32/include/hal/include/hal/i2s_types.h:95:5: note: declared here

 I2S_COMM_FORMAT_I2S       __attribute__((deprecated)) = 0x01, /*!< I2S communication format I2S, correspond to `I2S_COMM_FORMAT_STAND_I2S`*/

 ^~~~~~~~~~~~~~~~~~~

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: sketch\sketch_feb11a.ino.cpp.o:(.literal._ZL15i2sMicroFFTtaskPv+0x28): undefined reference to `fft_init(int, fft_type_t, fft_direction_t, float*, float*)'

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: sketch\sketch_feb11a.ino.cpp.o:(.literal._ZL15i2sMicroFFTtaskPv+0x2c): undefined reference to `fft_execute(fft_config_t*)'

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: sketch\sketch_feb11a.ino.cpp.o:(.literal._ZL15i2sMicroFFTtaskPv+0x38): undefined reference to `fft_destroy(fft_config_t*)'

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: sketch\sketch_feb11a.ino.cpp.o: in function `i2sMicroFFTtask(void*)':

C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659/sketch_feb11a.ino:93: undefined reference to `fft_init(int, fft_type_t, fft_direction_t, float*, float*)'

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659/sketch_feb11a.ino:97: undefined reference to `fft_execute(fft_config_t*)'

c:/users/andre/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\andre\AppData\Local\Temp\arduino_modified_sketch_309659/sketch_feb11a.ino:115: undefined reference to `fft_destroy(fft_config_t*)'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "SD.h"

Used: C:\Users\andre\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.2\libraries\SD

Not used: C:\Program Files (x86)\Arduino\libraries\SD

Multiple libraries were found for "WiFiClient.h"

Used: C:\Users\andre\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.2\libraries\WiFi

Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

exit status 1

Error compiling for board M5Stack-Core-ESP32.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

LoRaWAN example unsupported commands

Hi

I tried out the LoRaWAN examples with the M5 COM.X LoRaWAN module. It doesn't work and after some troubleshooting it turns out that for most of the commands sent to the LoRA module, the response is +ERROR: Command does not exist

Also really important to notice is that if you run it with a Core2 you need to replace the M5Stack.h include with M5Core2.h and comment out lora.init(); and replace it with Serial2.begin(115200, SERIAL_8N1, 13, 14); because the M-bus pinout is different.
And finally replace M5.begin(); with M5.begin(true, true, true, false, kMBusModeInput);

It could be a good idea to have this info in the beginning of the .ino

But none of the above changes will make it work, as long as the commands in the lib are non-existent.

RFID UIFlow does not load

Hello, when I try to open the RFID file for UIFlow, nothing shows up (it works well with other M5F files).
Also, when using the code from Arduino IDE, it says "no matching function for call to 'MFRC522::MFRC522(int)'".

Can anyone help me with that please?

HTTP POST/GET Exemple GSM Module MT6315

Since the AT Commands Manual is in chinese, and the at commands for connecting to bearer and making http post and get are completely different from sim800l modem, it would be nice some code examples demonstrating how to properly connect to the bearer via gprs and make get and post requests to websites.

AtomicGPS speed of movement - unit of measurement?

Hello,

I'm trying to get speed of movement of GPS module (AtomicGPS) using your example code via GPS.s_GNRMC.TrackSpeed parameter from GPSAnalyse::AnaGPRMC function in GPSAnalyse.cpp.

It seems this parameter returns speed values but in unknown (for me) scale.

I've compare with speed measurement with my car measurement (kmh) and it seems AtomicGPS, results about half of the real speed (there is correlation).

What is unit of measurement returned by this function in example library??

Regards,
M

'struct i2s_config_t' has no member named 'tx_desc_auto_clear'

Just trying to compile the Core2_Factory_test example code gives me the following error in the Arduino IDE:

/home/koan/M5-ProductExampleCodes/Core/M5Core2/Arduino/Core2_Factory_test/Core2_Factory_test.ino: In function 'bool InitI2SSpakerOrMic(int)':
Core2_Factory_test:304:20: error: 'struct i2s_config_t' has no member named 'tx_desc_auto_clear'
         i2s_config.tx_desc_auto_clear = true;

This is on Arduino 1.8.13 with the esp32 1.0.4 board support from Espressif, and the M5Core2 0.0.1 library installed.

Any pointers to what could be wrong?

Core2 Factory test bugs (checkI2cAddr())

This function warns that I2C devices are not found.
In the M5Core2 library, Pin definition of Wire and Wire1 are the same and Wire is not valid.

`
int checkI2cAddr(){
uint8_t count = 0;
i2cDevice_t *lastptr = &i2cParentptr;
do{
lastptr = lastptr->nextPtr;
Serial.printf("Addr:0x%02X - Name:%s\r\n",lastptr->addr,lastptr->Name.c_str());
// Wire.beginTransmission( lastptr->addr );
Wire1.beginTransmission( lastptr->addr );
// if ( Wire.endTransmission() == 0 )
if ( Wire1.endTransmission() == 0 )
{

`

Getting the STT data on another device

Hello,
could you please give an example of how to get the data returned from the server on a different device, not the Echo,
I know it is possible as it works in UIflow, but I need it in Arduino code.
Thank you

CAM2CORE not working?

Hello, I am using unit cam with a Core 2. I want to communicate through UART, just like the video on that page. I followed the connections given, and uploaded the arduino sketch. After doing so, the blue LED blinks for three times then my previous firmware completely freezes and nothing else works. I have attempted to to erase the previous firmware, then uploading the arduino sketch. Nothing.

I have tried to use the m5flow programming blocks, yet there is no support for the unit? I attempt to click on it, yet it is grayed out. See this image.

I don't understand, am I doing something wrong?

Stuck getting started on COM.NB-IoT (SIM7020G) with Core2

Have a new COM.NB-IoT (SIM7020G) with Core2 but can't get get anything much to work.

Have an external 5v power supply for the COM.NB-IoT and inserted a SIM card and attached to the Core2. POwering on the external power supply starts LEDs flashing in the COM.NB-IoT and the Core2 boots up, so that looks like its all connected together properly.

Flashing the Core2 with the EasyLoader from the COM.NB-IoT doc page and connecting a Serial Monitor shows:
M5Stack initializing... AT+CSQ
AT+CSQ
AT+CSQ
AT+CSQ
with the AT+CSQ repeating every 10 seconds.

So it looks like there is a problem with the serial connection to the COM.NB-IoT.

Hunting around I found this repo, and in there this example: https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/COMX_NB-IoT

That uses #include <M5Stack.h> which doesn't appear to work with the Core2 so changing it to #include <M5Core2.h> and adding #include <AXP192.h> to fix another compile error, and this doc page https://shop.m5stack.com/products/com-nb-iot-modulesim7020g talks about changing the M5 and Serial2 begin, so I've done that and this is the diff to this repo:

git diff
diff --git a/Module/COMX_NB-IoT/COMX_NB-IoT.ino b/Module/COMX_NB-IoT/COMX_NB-IoT.ino
index 50a9284..b322485 100644
--- a/Module/COMX_NB-IoT/COMX_NB-IoT.ino
+++ b/Module/COMX_NB-IoT/COMX_NB-IoT.ino
@@ -1,4 +1,5 @@
-#include <M5Stack.h>
+#include <M5Core2.h>^M
+#include <AXP192.h>^M
 #include <stdint.h>
 #include <vector>
 #include "TFTTerminal.h"
@@ -303,8 +304,10 @@ uint8_t restate;
 void setup()
 {
        // put your setup code here, to run once:
-       M5.begin();
-       Serial2.begin(115200, SERIAL_8N1, 5, 13);
+       //M5.begin();^M
+       //Serial2.begin(115200, SERIAL_8N1, 5, 13);^M
+        M5.begin(true, true, true, false, kMBusModeInput);^M
+        Serial2.begin(115200, SERIAL_8N1, 13, 14);^M

        Disbuff.createSprite(320,20);
        Disbuff.fillRect(0,0,320,20,BLACK);
diff --git a/Module/COMX_NB-IoT/TFTTerminal.h b/Module/COMX_NB-IoT/TFTTerminal.h
index 6142e42..2b6d1d6 100644
--- a/Module/COMX_NB-IoT/TFTTerminal.h
+++ b/Module/COMX_NB-IoT/TFTTerminal.h
@@ -1,7 +1,7 @@
 #ifndef _TFTTERMINAL_H_
 #define _TFTTERMINAL_H_

-#include <M5Stack.h>
+#include <M5Core2.h>^M
 #include <Print.h>

 class TFTTerminal : public Print

Flashing the Core2 with that and connecting serial monitor shows this and just the repeating AT+CSQ:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12804
ho 0 tail 12 room 4
load:0x40080400,len:3032
entry 0x400805e4
M5Core2 initializing...axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
E (1435) ledc: ledc_channel_config(369): gpio_num argument is invalid
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
AT+CSQ
AT+CSQ
AT+CSQ
...

What am I doing wrong?

Thanks for any help!

No need to wait after Wire.requestFrom().

In the files:

  • M5-ProductExampleCodes/Hat/tof-hat/Arduino/ToF_Count/ToF_Count.ino
  • M5-ProductExampleCodes/Unit/TOF/Arduino/MeasureDistance/MeasureDistance.ino
  • M5-ProductExampleCodes/Unit/TOF/Arduino/TOF_VL53L0X/TOF_VL53L0X.ino

there is waiting after a Wire.requestFrom().
You may remove all these lines: while (Wire.available() < 1) delay(1);

In the files:

  • M5-ProductExampleCodes/Unit/ENV/Arduino/ENV/DHT12.cpp
  • M5-ProductExampleCodes/Core/m5go/m5go_lite/Arduino/ENV/DHT12.cpp

there is a delay after the Wire.requestFrom(). That is delay is not needed for interfacing with the Wire library.

In the file:

  • M5-ProductExampleCodes/Unit/EXTIO/Arduino/EXT_IO/PCA9554.cpp

you may remove this line: while (Wire.available() < 1);

Explanation: Common-mistakes#1

How to do TTS?

Is there an example to show how to perform TTS? Takes text input and convert to speech.

joyc.ino Arduino Code Error undefined reference to `connect_off'/ `connect_on'

https://github.com/m5stack/M5-ProductExampleCodes/blob/f78fc2e2a48c8b2eda031985d5dc5f774317e634/Hat/JoyC/Arduino/JoyC/JoyC.ino

@Kiko62 could you suggestion any ideas about what version you can compile?
I tried different esp32 versions (1.0.2-1.0.5) in board manager but also failed.
Choose board m5stick-c.

Compiliation erro with arduino ide 1.8.13

sketch\joyc.ino.cpp.o:(.literal._Z4loopv+0x8): undefined reference to `connect_off'
sketch\joyc.ino.cpp.o:(.literal._Z5setupv+0x3c): undefined reference to `connect_on'

Compilation error with platform.io

.pio\build\m5stick-c\src\joyc.ino.cpp.o:(.literal._Z4loopv+0x8): undefined reference to `connect_off'
.pio\build\m5stick-c\src\joyc.ino.cpp.o:(.literal._Z5setupv+0x40): undefined reference to `connect_on'

graphical error in M5StickC slot machine demo

There is a bug in the slot machine demo which causes affects the shadowing effect that is composited on the top and bottom of the spinning slot machine wheels. This bug causes the line on the very first and last row of the screen (which should be the darkest) to be full brightness.

In the file Slot.cpp (inside of the ZIP archive in App/M5StickC_Slot/), line 154 should look like this:

for (int i = 0; i < shadowHeight; i++) {

Currently this for loop starts with "int i = 1", which causes the darkest line of the shadow to have an undefined brightness value.

Core2 Factory Test PSRAM malloc failed

Sketch is too large when compiled with M5Stick Core on Arduino IDE 1.8.13 (should a different core be used?)
IMG_20201011_133909807
IMG_20201011_134343421

Changing "partition scheme" to No OTA large app allows the sketch to compile and upload

The device gives a PSRAM malloc failed error on the screen, tapping the screen will get past it.
but the screen doesn't display correctly.
touching the imu block, doesn't update the screen, or the imu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.