🤖Have you ever tried Chat.M5Stack.com before asking??😎
  • Saving and reusing variables?

    7
    0 Votes
    7 Posts
    17k Views
    M
    @world101 thank you a lot!!!
  • How to used V-training yolo3????

    4
    0 Votes
    4 Posts
    8k Views
    m5stackM
    @ruvic101 use the last version firmware. (you could find it in this page :https://docs.m5stack.com/#/en/quick_start/m5stickv/m5stickv_quick_start) also , for the time being the yolov3 function is unstable . even you loading success the model and runing. It may still happend memory not enough
  • 0 Votes
    1 Posts
    7k Views
    No one has replied
  • Lesson 23. M5CAMERA. Introduce

    2
    0 Votes
    2 Posts
    9k Views
    N
    Is there an easy way of connecting it to a wifi router?
  • Lesson 14.2. UI Flow. Burning with Mac

    4
    1 Votes
    4 Posts
    14k Views
    lukasmaximusL
    This information is outdated anyway, you can flash the firmware on mac using the firmware burner tool within uiflow desktop version
  • Lesson 10. Radio 433 MHz. Alaram system

    2
    1 Votes
    2 Posts
    10k Views
    Q
    @dimi Great article, thanks. I was wondering if you could provide some better detail about the connections to the M5Stack, especially the 433Mhz receiver - looks like it goes to the grove port but is specified as Pin 5 in the code?
  • Lesson 18. Russian language

    2
    1 Votes
    2 Posts
    6k Views
    E
    Don't working after updating library M5Stack. No russian forevermore?
  • Lesson 3.1. Wi-Fi. Access point

    7
    0 Votes
    7 Posts
    46k Views
    C
    Modified for M5StickC #include <M5StickC.h> #include "WiFi.h" char ssid[] = "M5StickC"; char password[] = "12345678"; WiFiServer server(80); IPAddress ip(192, 168, 0, 1); IPAddress gateway(192, 168, 0, 1); IPAddress subnet(255, 255, 255, 0); extern unsigned char lightOn[]; extern unsigned char lightOff[]; String M5STACK_DATA; uint8_t led_count = 8; void setup() { m5.begin(); WiFi.mode(WIFI_AP); WiFi.softAP(ssid, password); WiFi.softAPConfig(ip, gateway, subnet); WiFi.begin(); server.begin(); //M5.Lcd.setBrightness(100); //M5.Lcd.setTextSize(3); //M5.Lcd.setCursor(50, 20); M5.Lcd.print("Wi-Fi Server"); //M5.Lcd.setTextSize(2); //M5.Lcd.setCursor(50, 60); M5.Lcd.print("SSID: "); M5.Lcd.print(ssid); //M5.Lcd.setCursor(50, 80); //M5.Lcd.print("PSWD: "); //M5.Lcd.print(password); //M5.Lcd.setCursor(50, 100); M5.Lcd.print("URL: "); M5.Lcd.print(ip); pinMode(M5_LED, OUTPUT); digitalWrite(M5_LED, HIGH); pinMode(M5_BUTTON_HOME, INPUT); M5.Axp.ScreenBreath(led_count); } String parseGET(String str) { String tmp = ""; for (int i = 0, j = 0; i < str.length(); i++) { if (str[i] == ' ') j++; if (j == 1) { if (str[i] != ' ') tmp += str[i]; } if (j == 2) break; } return tmp; } bool button(int contactNumber) { if (digitalRead(contactNumber) == LOW) { delay(10); if (digitalRead(contactNumber) == LOW) return true; } return false; } void loop() { if(digitalRead(M5_BUTTON_HOME) == LOW){ led_count++; if(led_count > 12) led_count = 7; while(digitalRead(M5_BUTTON_HOME) == LOW); M5.Axp.ScreenBreath(led_count); } String currentString = ""; bool readyResponse = false; WiFiClient client = server.available(); while (client.connected()) { if (client.available()) { /*if (button(button_A)) { M5.Lcd.fillRect(45, 230, 230, 5, BLACK); M5.Lcd.fillRect(45, 230, 50, 5, 0xf980); M5.Lcd.drawLine(135, 235, 184, 235, 0x4c0); M5.Lcd.drawLine(225, 235, 274, 235, 0x013); M5STACK_DATA = "hello from red button A!"; } if (button(button_B)) { M5.Lcd.fillRect(45, 230, 230, 5, BLACK); M5.Lcd.drawLine(45, 235, 94, 235, 0xf980); M5.Lcd.fillRect(135, 230, 50, 5, 0x37e0); M5.Lcd.drawLine(225, 235, 274, 235, 0x013); M5STACK_DATA = "hello from green button B!"; } if (button(button_C)) { M5.Lcd.fillRect(45, 230, 230, 5, BLACK); M5.Lcd.drawLine(45, 235, 94, 235, 0xf980); M5.Lcd.drawLine(135, 235, 184, 235, 0x4c0); M5.Lcd.fillRect(225, 230, 50, 5, 0x19f); M5STACK_DATA = "hello from blue button C!"; }*/ char c = client.read(); if (c != '\r') { if (c != '\n') { currentString += c; } } else { //M5.Lcd.print(currentString); //M5.Lcd.print("\n"); readyResponse = true; // готов отдать браузеру } if (readyResponse) // отдать браузеру { String GET = parseGET(currentString); //client.flush(); client.println("HTTP/1.1 200 OK"); client.println("Content-type:text/html"); client.println(); if (GET == "/update") { client.print("<html>"); client.print("<head>"); client.print("<meta http-equiv=\"Refresh\" content=\"1\"/>"); client.print("<script type=\"text/javascript\">"); client.print("var M5STACK_DATA = \""); client.print(M5STACK_DATA); client.print("\";"); client.print("</script>"); client.print("</head>"); client.print("</html>"); } else { client.print("<html>"); client.print("<head>"); client.print("<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />"); client.print("<script type=\"text/javascript\">"); client.print("setInterval(function(){document.getElementById(\"M5STACK_DATA\").innerHTML = window.frames[0].M5STACK_DATA;}, 1000);"); client.print("</script>"); client.print("</head>"); client.print("<body>"); //client.print("<h1>M5StickC</h1>"); //client.print("<h2>Wi-Fi Server</h2>"); //client.print("<hr>"); client.print("<h3>Remote control:</h3>"); //client.print("<span>Note: please click on the button and look at the screen of the device</span>"); //client.print("<br><br>"); if ((GET == "/off?") || (GET == "/")) { digitalWrite(M5_LED, HIGH); //M5.Lcd.drawBitmap(126, 120, 100, 100, (uint16_t *)lightOff); client.print("<form action=\"/on\">"); client.print("<button style=\"width: 200px; height: 200px;\" type=\"submit\">Turn ON</button>"); } else if (GET == "/on?") { digitalWrite(M5_LED, LOW); //M5.Lcd.drawBitmap(126, 120, 100, 100, (uint16_t *)lightOn); client.print("<form action=\"/off\">"); client.print("<button style=\"width: 200px; height: 200px;\" type=\"submit\">Turn OFF</button>"); } client.print("</form>"); client.print("<hr>"); client.print("<h3>Remote monitor:</h3>"); //client.print("<span>Note: please press and hold any three buttons on the device</span>"); //client.print("<br>"); client.print("<span id=\"M5STACK_DATA\"></span>"); client.print("<iframe src=\"/update\" hidden=\"true\"></iframe>"); client.print("</body>"); client.print("</html>"); } client.println(); client.println(); readyResponse = false; currentString = ""; break; } } } }
  • Lesson 6.1. Speaker. MP3 player

    9
    4 Votes
    9 Posts
    52k Views
    C
    Hi @Dimi, thanks for the amazing tutorial. Can I ask a question? I want to make an m5stack program that would play an mp3 file if I send a trigger via UDP, and would stop if I send a different trigger via UDP. I followed some of your code. But when I sent the trigger, the mp3 only played the first second and kept repeating the same time position. It wouldn't play the entire mp3 song. This is the code that I used: #include <M5Stack.h> #include <WiFi.h> #include <WiFiUdp.h> #include "AudioFileSourceSD.h" #include "AudioFileSourceID3.h" #include "AudioGeneratorMP3.h" #include "AudioOutputI2S.h" #define N 1024 bool playing = true; AudioGeneratorMP3 *mp3; AudioFileSourceSD *file; AudioOutputI2S *out; AudioFileSourceID3 *id3; const char* ssid = "wifiname"; const char* password = "wifipassword"; const int port = 5555; // The udp library class WiFiUDP udp; void print_wifi_state(){ M5.Lcd.clear(BLACK); // clear LCD M5.Lcd.setTextColor(YELLOW); M5.Lcd.setCursor(3, 3); M5.Lcd.println(""); M5.Lcd.println("WiFi connected."); M5.Lcd.print("IP address: "); M5.Lcd.println(WiFi.localIP()); M5.Lcd.print("Port: "); M5.Lcd.println(port); } void setup_wifi(){ M5.Lcd.setTextColor(RED); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(3, 10); M5.Lcd.print("Connecting to "); M5.Lcd.println(ssid); // setup wifi WiFi.mode(WIFI_STA); // WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF WiFi.begin(ssid, password); // WiFi.begin(); // Connecting .. while (WiFi.status() != WL_CONNECTED) { delay(100); M5.Lcd.print("."); } // print state print_wifi_state(); udp.begin(port); } void setup() { M5.begin(); M5.Speaker.setVolume(5); play('m'); // setup wifi setup_wifi(); } bool play(char dir){ switch(dir) { case 'm': delete file; delete out; delete mp3; mp3 = NULL; file = NULL; out = NULL; file = new AudioFileSourceSD("/"); id3 = new AudioFileSourceID3(file); out = new AudioOutputI2S(0, 1); out->SetOutputModeMono(true); mp3 = new AudioGeneratorMP3(); mp3->begin(id3, out); playing = false; return true; default: if(playing){ play('m'); return true; } break; } mp3->stop(); delete file; delete out; delete mp3; mp3 = NULL; file = NULL; out = NULL; file = new AudioFileSourceSD("/RainDrizzle.mp3"); id3 = new AudioFileSourceID3(file); id3->seek(trackList->timePos, 1); out = new AudioOutputI2S(0, 1); out->SetOutputModeMono(true); mp3 = new AudioGeneratorMP3(); mp3->begin(id3, out); playing = true; return true; } void loop() { char packetBuffer[N]; int packetSize = udp.parsePacket(); // get packet if (packetSize){ int len = udp.read(packetBuffer, packetSize); if (len > 0){ packetBuffer[len] = '\0'; // end } } if(strcmp(packetBuffer,"start")==0){ // print param M5.Lcd.clear(BLACK); M5.Lcd.setCursor(3, 3); M5.Lcd.setTextColor(GREEN); M5.Lcd.println(packetBuffer); play('t'); } if(strcmp(packetBuffer,"stop")==0){ M5.Lcd.clear(BLACK); M5.Lcd.setCursor(3, 3); M5.Lcd.setTextColor(GREEN); M5.Lcd.println(packetBuffer); play('m'); } if(playing){ if(mp3->isRunning()){ if(!mp3->loop()){ mp3->stop(); playing = false; } } else{ delay(1000); } } M5.update(); } Thank you in advance.
  • Can't flash the M5stack FIRE

    6
    0 Votes
    6 Posts
    14k Views
    lukasmaximusL
    @Alpine-Lake which operating system are you on? If on Mac Uiflow software must be in the applications folder for the firmware burner to be able to download the firmware files and function properly
  • Lesson 13. FACES. NES Games

    14
    2 Votes
    14 Posts
    36k Views
    D
    I had problem about color too, I tried to read other LCD libraries to know why. The easy way to solve the problem is adding invert color command to ili_init_cmds. I hope it's code will be updated soon.
  • Initialization?

    3
    0 Votes
    3 Posts
    9k Views
    lukasmaximusL
    @flypeek pretty nice tool to install legacy M5Stack firmware. Did you make this? and is it only compatible with mac?
  • Lesson 22. Modules. SIM800L

    Moved
    2
    1 Votes
    2 Posts
    11k Views
    C
    Is there Arduino code available? I have some problems with the examples added to the library.
  • [WIP] M5ez Hello World.

    15
    1 Votes
    15 Posts
    34k Views
    ajb2k3A
    @orthodudz I worked it out now and currently writing up how for my handbook project. I have managed to get an image to load without m5ez using UIFlow but you will need to see the face book group for the progress.
  • 0 Votes
    1 Posts
    7k Views
    No one has replied
  • Lesson 1.0. Let's start. Hello, MacOS

    4
    1 Votes
    4 Posts
    19k Views
    Y
    FYI, We can use Arduino Board Manager now. (Figure 3.1 ~ 3.4 can skip.) Start Arduino and open Preferences window. Enter https://dl.espressif.com/dl/package_esp32_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. Open Boards Manager from Tools > Board menu and install esp32 platform (and don't forget to select your ESP32 board from Tools > Board menu after installation). arduino-esp32/boards_manager.md at master · espressif/arduino-esp32
  • [Updated] 20-04-2019 UIFlow big update.

    26
    0 Votes
    26 Posts
    108k Views
    ajb2k3A
    Update time, nearly up to 100 pages and still haven't started on the blocks. !https://github.com/Ajb2k3/UIFlowHandbook/blob/master/UIFlowhandbook.pdf
  • Lesson 15.1. UIFlow it's easy

    1
    0 Votes
    1 Posts
    11k Views
    No one has replied
  • Lesson 15.1. UIFlow it's easy

    1
    0 Votes
    1 Posts
    10k Views
    No one has replied
  • Lesson 21.1. UNITS. LIGHT

    4
    0 Votes
    4 Posts
    12k Views
    DimiD
    @lastcaress You can to increase a delay interval.