Lesson 1.0. Let's start. Hello, MacOS



  • The purpose of this lesson

    Hi! Today we will learn how to connect M5STACK to Arduino IDE on MacOS (Fig. 1). Let's display "HELLO MAC".

    Figure 1

    A little theory

    MacOS has significant differences from Windows, so the connection procedure is different too. The main part of the work will be done through the standard application Terminal. You must also know the password for your account, as it is required for the driver installer to make changes.

    More information about the Terminal app on the Wiki: here

    List of components for the lesson

    • Apple computer with MacOS;
    • M5STACK;
    • USB-C cable from the standard set.

    Begin!

    Step 1. Download and install the driver

    We use the standard Safari browser to visit the official website of M5STACK (Fig. 2, 2.1).

    Figure 2. The Safari browser on the dock bar

    Figure 2.1. Address bar with the address entered

    Click on the section Download, then Mac Click here (Fig. 2.2).

    Figure 2.2

    The download will begin. When the download is completed, click on the magnifying glass icon to open the driver installer folder (Fig. 2.3).

    Figure 2.3

    Open the driver installer by holding down ctrl on the keyboard and right-clicking on the icon (Fig. 2.4).

    Figure 2.4

    Similarly, open the driver unpack (Fig. 2.5).

    Figure 2.5

    Go through all the steps according to figures 2.6 - 2.11.

    Figure 2.6

    Figure 2.7

    Figure 2.8

    Figure 2.9

    Figure 2.10

    Figure 2.10.1

    Figure 2.11

    Next, you need to unlock the software driver developer. To do this, click on the Apple in the upper right corner and select the section System Preferences... (rice. 2.12).

    Figure 2.12

    Next, open the "Security & Privacy" section (Fig. 2.13).

    Figure 2.13

    In the tab General click on the button Allow opposite this developer (Fig. 2.14).

    Figure 2.14

    This completes the driver installation safely!

    Step 2. Download and install the Arduino IDE

    Download Arduino IDE for MacOS under SOFTWARE on the official Arduino website here (Fig. 3)

    Figure 3

    After the download is complete, open the Arduino file from the downloads folder (Fig. 3.1). After the program opens, close it.

    Figure 3.1

    Now add libraries using the Terminal application. To do this, click the mouse on the magnifying glass icon in the upper right corner and write the name of the application (Fig. 3.2). Next, double-click to launch the application itself.

    Figure 3.2

    Copy (⌘C) from all text and paste (⌘V) it in Terminal, then click Enter (Fig. 3.3).

    mkdir -p ~/Documents/Arduino/hardware/espressif && \
    cd ~/Documents/Arduino/hardware/espressif && \
    git clone https://github.com/espressif/arduino-esp32.git esp32 && \
    cd esp32 && \
    git submodule update --init --recursive && \
    cd tools && \
    python get.py
    

    Figure 3.3

    The download and installation of the required components will begin (Fig. 3.4).

    Figure 3.4

    At the end of the installation on the last line written will be Done (Fig. 3.5). After that, the terminal must be closed.

    Figure 3.5

    This completes the installation of the libraries!

    Step 3. First sketch

    Start Arduino IDE, see Fig. 3.1. Copy and paste the following text into the Arduino IDE (Fig. 4):

    #include <m5stack.h>
    
    void setup() {
    M5.begin();
    M5.Lcd.print ("HELLO, MacOS");
    }
    
    void loop() {
    
    }
    

    Figure 4

    Next, set up the Board. To do this, select in the menu item Tools in the section Board: Board "M5Stack-Core-ESP32" (Fig. 4.1).

    Figure 4.1

    Select a port. To do this, select the menu item Tools under Port: port /dev/cu.SLAB_USBtoUART (Fig. 4.2).


    Figure 4.2

    Nearly ready! Connect your M5 to your Mac using a USB-C cable and press the Upload button (Fig. 4.3).

    Figure 4.3

    After the firmware is successfully loaded into the device, the text will appear on the screen (Fig. 4.4).

    Figure 4.4

    This lesson is over 👨‍💻



  • @dimiLesson 1.0. Let's start. Hello, MacOS 中说:

    #include <m5stack.h>

    void setup() {
    M5.begin();
    M5.Lcd.print ("HELLO, MacOS");

    Shouldn't this be #include <M5Stack.h> now (upper case M and S)?



  • @Dimi Nice one, was going to add a version to my post but you covered it well.



  • 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