├── Arduino_ESP32 ├── arduino_example │ ├── ESP32 │ │ ├── ESP32.ino │ │ └── makerfabs_pin.h │ └── wifi_set_demo │ │ ├── .vscode │ │ └── settings.json │ │ ├── wifi_save.cpp │ │ ├── wifi_save.h │ │ └── wifi_set_demo.ino ├── md_pic │ ├── arduino_esp32.png │ ├── board_install.jpg │ ├── complair_option.png │ ├── library.png │ ├── normal_esp32.jpg │ ├── zip_lib-2.png │ └── zip_lib.png └── readme.md ├── Arduino_Maduino ├── md_pic │ ├── board_install.jpg │ ├── cp2104-2.png │ ├── cp2104.png │ ├── library.png │ ├── pro.png │ ├── zero-2.png │ ├── zip_lib-2.png │ └── zip_lib.png └── readme.md ├── MaESP ├── md_pic │ ├── pic1.jpg │ ├── pic10.jpg │ ├── pic11.jpg │ ├── pic2.jpg │ ├── pic3.jpg │ ├── pic4.jpg │ ├── pic5.jpg │ ├── pic6.jpg │ ├── pic7.jpg │ ├── pic8.jpg │ └── pic9.jpg └── readme.md ├── MakePython ├── md_pic │ ├── burn_firmware.png │ ├── default_run.jpg │ ├── upy.png │ ├── upy1.png │ ├── upy2.png │ ├── upy3.png │ ├── upy4.png │ ├── upy5.png │ ├── upy6.png │ └── upy7.png ├── micropython-bin │ └── esp32-idf3-20191220-v1.12.bin └── readme.md ├── pins_define └── makerfabs_pin.h └── readme.md /Arduino_ESP32/arduino_example/ESP32/ESP32.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 标题 : ESP32 样例 3 | 作者 : Vincent 4 | 创建 : 2020/9/8 5 | 修改 : 2020/9/8 6 | 笔记 : 7 | 1,创建一个包含所有常用协议初始化的demo,包含I2C,SPI等,便于快速开发。 8 | 2,I2C屏幕的开机画面和简单显示。 9 | 3,WiFi连接,并get请求一个简单的天气数据。 10 | 完成4,板载按键控制。 11 | 12 | 备注 : 用于快速开发,仅包含板载功能。 13 | 14 | */ 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "makerfabs_pin.h" 21 | 22 | // SSD1306连接到的是硬件I2C上,在setup()部分初始化 23 | Adafruit_SSD1306 display(MP_ESP32_SSD1306_WIDTH, MP_ESP32_SSD1306_HEIGHT, &Wire, MP_ESP32_SSD1306_RST); 24 | Adafruit_SSD1306 *p_display = &display; 25 | 26 | bool button_status = true; 27 | 28 | void setup() 29 | { 30 | //乐鑫ESP32均有一个RST和FLASH按键,FLASH为IO0 31 | pinMode(MP_ESP32_FLASH_BUTTON, INPUT); 32 | 33 | Serial.begin(115200); 34 | //I2C初始化,用于二次配置引脚。 35 | Wire.begin(MP_ESP32_I2C_SDA, MP_ESP32_I2C_SCL); 36 | //SSD1306初始化 37 | if (SSD1306_init(p_display)) 38 | Serial.println("ERROR CODE:SSD1306 WRONG"); 39 | } 40 | 41 | void loop() 42 | { 43 | if (digitalRead(MP_ESP32_FLASH_BUTTON) == 0) 44 | { 45 | delay(40); 46 | if (digitalRead(MP_ESP32_FLASH_BUTTON) == 0) 47 | { 48 | button_status = !button_status; 49 | Serial.println(button_status); 50 | if (button_status) 51 | { 52 | display.fillScreen(SSD1306_BLACK); 53 | } 54 | else 55 | { 56 | display.fillScreen(SSD1306_WHITE); 57 | } 58 | display.display(); 59 | while (digitalRead(MP_ESP32_FLASH_BUTTON) == 0) 60 | ; 61 | } 62 | } 63 | delay(200); 64 | } 65 | 66 | /* 67 | 模块初始化函数: 68 | 1,SSD1306 69 | 2,WiFi 70 | */ 71 | 72 | //SSD1306初始化,电压选项,I2C地址设置 73 | int SSD1306_init(Adafruit_SSD1306 * oled) 74 | { 75 | //地址为0x3C,adafruit的驱动中为0x3D,可能因芯片厂家不同导致的。 76 | // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 77 | if (!oled->begin(SSD1306_SWITCHCAPVCC, MP_ESP32_SSD1306_I2C_ADDR)) 78 | { 79 | return -1; 80 | } 81 | 82 | oled->clearDisplay(); 83 | oled->display(); 84 | return 0; 85 | } -------------------------------------------------------------------------------- /Arduino_ESP32/arduino_example/ESP32/makerfabs_pin.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------- 3 | titile : Makerfabs IO define 4 | author : Vincent 5 | create : 2020/9/4 6 | version : 1.0 7 | update : 2020/9/8 8 | 9 | Note: 10 | 11 | 1. 12 | For easy use ESP32 GPIO,define SPI, I2C, and LCD, SDcard pins. 13 | And define some parameters, such as screen size. 14 | 15 | 2. 16 | Sigillum: 17 | MP = MakePython 18 | MP_ESP32 = MakePython ESP32 SSD1306 19 | MP_ESP32_COLOR = MakePython ESP32 Color LCD (ST7789) 20 | 21 | TSC = Touch Screen Camera 22 | ESP32_TSC_9488 = ESP32 Touch Screen Camera With ILI9488 23 | 24 | 3. 25 | //#define ESP32_COLOR_7789 OK 26 | "Ok" means tested and ready to use 27 | Don't use "ERR" or "TEST" 28 | 29 | 4. 30 | For the motherboard combination expansion board. 31 | This is to be determined and may be modified. 32 | A more prudent approach is to copy the pin value directly. 33 | 34 | ------------------------------------------------- 35 | Support List: 36 | 37 | (1)MakePython: 38 | MakePython ESP32 COLOR LCD 39 | MakePython ESP32 SSD1306 40 | 41 | (2)Touch Screen Camera: 42 | ESP32 Touch Screen Camera With 9488 43 | 44 | ------------------------------------------------- 45 | */ 46 | 47 | //BOARD 48 | 49 | #define MP_ESP32 OK 50 | //#define MP_ESP32_COLOR OK 51 | //#define ESP32_TSC_9488 OK 52 | //#define ESP32_ILI9341 ERR don't use 53 | 54 | //SHIELD 55 | #define MP_AUDIO OK 56 | 57 | /* 58 | update : 2020/9/8 59 | name : MakePython ESP32 SSD1306 60 | sigillum: MP_ESP32_COLOR 61 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_ESP32 62 | module : 63 | (1) 1.3inch OLED SSD1306 64 | 65 | */ 66 | #ifdef MP_ESP32 67 | 68 | #define MP_ESP32_FLASH_BUTTON 0 69 | 70 | //I2C 71 | #define MP_ESP32_I2C_SDA 4 72 | #define MP_ESP32_I2C_SCL 5 73 | 74 | //HSPI 75 | #define MP_ESP32_HSPI_MOSI 13 76 | #define MP_ESP32_HSPI_MISO 12 77 | #define MP_ESP32_HSPI_SCK 14 78 | #define MP_ESP32_HSPI_CS 15 79 | 80 | //VSPI 81 | #define MP_ESP32_VSPI_MOSI 23 82 | #define MP_ESP32_VSPI_MISO 19 83 | #define MP_ESP32_VSPI_SCK 18 84 | #define MP_ESP32_VSPI_CS 5 85 | 86 | //SSD1306 87 | #define MP_ESP32_SSD1306_I2C_ADDR 0x3C 88 | #define MP_ESP32_SSD1306_WIDTH 128 // OLED display width, in pixels 89 | #define MP_ESP32_SSD1306_HEIGHT 64 // OLED display height, in pixels 90 | #define MP_ESP32_SSD1306_RST 4 91 | 92 | #endif 93 | 94 | /* 95 | update : 2020/9/11 96 | name : MakePython ESP32 COLOR LCD 97 | sigillum: MP_ESP32_COLOR 98 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_ESP32_Color_LCD 99 | module : 100 | (1) 1.3inch TFT ST7789 driver 101 | 102 | */ 103 | #ifdef MP_ESP32_COLOR 104 | 105 | //I2C 106 | #define MP_ESP32_COLOR_I2C_SDA 4 107 | #define MP_ESP32_COLOR_I2C_SCL 5 108 | 109 | //HSPI 110 | #define MP_ESP32_COLOR_HSPI_MOSI 13 111 | #define MP_ESP32_COLOR_HSPI_MISO 12 112 | #define MP_ESP32_COLOR_HSPI_SCK 14 113 | #define MP_ESP32_COLOR_HSPI_CS 15 114 | 115 | //VSPI 116 | #define MP_ESP32_COLOR_VSPI_MOSI 23 117 | #define MP_ESP32_COLOR_VSPI_MISO 19 118 | #define MP_ESP32_COLOR_VSPI_SCK 18 119 | #define MP_ESP32_COLOR_VSPI_CS 5 120 | 121 | //ST7789 122 | #define MP_ESP32_COLOR_LCD_MOSI MP_ESP32_COLOR_HSPI_MOSI 123 | #define MP_ESP32_COLOR_LCD_MISO MP_ESP32_COLOR_HSPI_MISO 124 | #define MP_ESP32_COLOR_LCD_SCK MP_ESP32_COLOR_HSPI_SCK 125 | 126 | #define MP_ESP32_COLOR_LCD_CS 15 127 | 128 | #define MP_ESP32_COLOR_LCD_RST 21 129 | #define MP_ESP32_COLOR_LCD_DC 22 130 | #define MP_ESP32_COLOR_LCD_BL -1 //5 131 | 132 | #define MP_ESP32_COLOR_LCD_WIDTH 240 133 | #define MP_ESP32_COLOR_LCD_HEIGHT 240 134 | #define MP_ESP32_COLOR_LCD_SPI_HOST HSPI_HOST 135 | 136 | #endif 137 | 138 | /* 139 | update : 2020/9/4 140 | name : ESP32 Touch Screen Camera With ILI9488 141 | sigillum: ESP32_TSC_9488 142 | wiki : 143 | module : 144 | (1) 3.5inch TFT ILI9488 driver 145 | (2) SDcard Reader 146 | (3) I2C Touch Screen(NS2009 or Ft6236) 147 | (4) OV2640 Camera 148 | */ 149 | 150 | #ifdef ESP32_TSC_9488 151 | 152 | //I2C 153 | #define ESP32_TSC_9488_I2C_SDA 26 154 | #define ESP32_TSC_9488_I2C_SCL 27 155 | 156 | //SPI 157 | #define ESP32_TSC_9488_HSPI_MOSI 13 158 | #define ESP32_TSC_9488_HSPI_MISO 12 159 | #define ESP32_TSC_9488_HSPI_SCK 14 160 | #define ESP32_TSC_9488_HSPI_CS 15 161 | 162 | //ILI9488 163 | #define ESP32_TSC_9488_LCD_MOSI ESP32_TSC_9488_HSPI_MOSI 164 | #define ESP32_TSC_9488_LCD_MISO ESP32_TSC_9488_HSPI_MISO 165 | #define ESP32_TSC_9488_LCD_SCK ESP32_TSC_9488_HSPI_SCK 166 | 167 | #define ESP32_TSC_9488_LCD_CS 15 168 | 169 | #define ESP32_TSC_9488_LCD_RST 26 170 | #define ESP32_TSC_9488_LCD_DC 33 171 | #define ESP32_TSC_9488_LCD_BL -1 172 | 173 | #define ESP32_TSC_9488_LCD_WIDTH 320 174 | #define ESP32_TSC_9488_LCD_HEIGHT 480 175 | #define ESP32_TSC_9488_LCD_SPI_HOST HSPI_HOST 176 | 177 | //SDcard 178 | #define ESP32_TSC_9488_SD_MOSI ESP32_TSC_9488_HSPI_MOSI 179 | #define ESP32_TSC_9488_SD_MISO ESP32_TSC_9488_HSPI_MISO 180 | #define ESP32_TSC_9488_SD_SCK ESP32_TSC_9488_HSPI_SCK 181 | 182 | #define ESP32_TSC_9488_SD_CS 4 183 | 184 | #endif 185 | 186 | /* 187 | name : ESP32 Touch Screen Camera With ILI9341 188 | Not ready 189 | */ 190 | 191 | #ifdef ESP32_ILI9341 192 | 193 | #define LCD_MOSI 13 194 | #define LCD_MISO 12 195 | #define LCD_SCK 14 196 | #define LCD_CS 18 197 | #define LCD_RST 21 198 | #define LCD_DC 22 199 | #define LCD_BL 19 //5 200 | 201 | #define LCD_WIDTH 240 202 | #define LCD_HEIGHT 240 203 | #define LCD_SPI_HOST VSPI_HOST 204 | 205 | #endif 206 | 207 | /* 208 | update : 2020/9/11 209 | name : MakePython ESP32 Audio 210 | sigillum: MP_AUDIO 211 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_Audio 212 | module : 213 | (1) audio jack(3.5mm) 214 | (2) SD Card 215 | (3) NXP Low power Audio DAC: uDA1334 216 | 217 | */ 218 | 219 | #ifdef MP_AUDIO 220 | 221 | //SD Card 222 | #define MP_AUDIO_SD_CS 22 223 | 224 | #if defined MP_ESP32 225 | #define MP_AUDIO_SPI_MOSI MP_ESP32_VSPI_MOSI 226 | #define MP_AUDIO_SPI_MISO MP_ESP32_VSPI_MISO 227 | #define MP_AUDIO_SPI_SCK MP_ESP32_VSPI_SCK 228 | 229 | #elif defined MP_ESP32_COLOR 230 | #define MP_AUDIO_SPI_MOSI MP_ESP32_COLOR_VSPI_MOSI 231 | #define MP_AUDIO_SPI_MISO MP_ESP32_COLOR_VSPI_MISO 232 | #define MP_AUDIO_SPI_SCK MP_ESP32_COLOR_VSPI_SCK 233 | 234 | #else 235 | #define MP_AUDIO_SPI_MOSI 23 236 | #define MP_AUDIO_SPI_MISO 19 237 | #define MP_AUDIO_SPI_SCK 18 238 | 239 | #endif 240 | 241 | //Digital I/O used //Makerfabs Audio V2.0 242 | #define MP_AUDIO_I2S_DOUT 27 243 | #define MP_AUDIO_I2S_BCLK 26 244 | #define MP_AUDIO_I2S_LRC 25 245 | 246 | //Button 247 | #define MP_AUDIO_Pin_vol_up 39 248 | #define MP_AUDIO_Pin_vol_down 36 249 | #define MP_AUDIO_Pin_mute 35 250 | #define MP_AUDIO_Pin_previous 15 251 | #define MP_AUDIO_Pin_pause 33 252 | #define MP_AUDIO_Pin_next 2 253 | 254 | #endif -------------------------------------------------------------------------------- /Arduino_ESP32/arduino_example/wifi_set_demo/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "wifi_save.h": "c" 4 | } 5 | } -------------------------------------------------------------------------------- /Arduino_ESP32/arduino_example/wifi_set_demo/wifi_save.cpp: -------------------------------------------------------------------------------- 1 | #include "wifi_save.h" 2 | 3 | WiFiServer server(80); 4 | int client_count = 0; 5 | 6 | int record_rst_time() 7 | { 8 | int rst_time = 0; 9 | // 初始化NVS,并检查初始化情况 10 | esp_err_t err = nvs_flash_init(); 11 | if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) 12 | { 13 | // 如果NVS分区被占用则对其进行擦除 14 | // 并再次初始化 15 | ESP_ERROR_CHECK(nvs_flash_erase()); 16 | err = nvs_flash_init(); 17 | } 18 | ESP_ERROR_CHECK(err); 19 | 20 | // Open 打开NVS文件 21 | printf("\n"); 22 | printf("Opening Non-Volatile Storage (NVS) handle... "); 23 | nvs_handle my_handle; // 定义不透明句柄 24 | err = nvs_open("storage", NVS_READWRITE, &my_handle); // 打开文件 25 | if (err != ESP_OK) 26 | { 27 | printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err)); 28 | } 29 | else 30 | { 31 | printf("Done\n"); 32 | 33 | // Read 34 | printf("Reading restart counter from NVS ... "); 35 | int32_t restart_counter = 0; // value will default to 0, if not set yet in NVS 36 | err = nvs_get_i32(my_handle, "restart_counter", &restart_counter); 37 | switch (err) 38 | { 39 | case ESP_OK: 40 | printf("Done\n"); 41 | printf("Restart counter = %d\n", restart_counter); 42 | rst_time = restart_counter; 43 | break; 44 | case ESP_ERR_NVS_NOT_FOUND: 45 | printf("The value is not initialized yet!\n"); 46 | break; 47 | default: 48 | printf("Error (%s) reading!\n", esp_err_to_name(err)); 49 | } 50 | 51 | // Write 52 | printf("Updating restart counter in NVS ... "); 53 | restart_counter++; 54 | err = nvs_set_i32(my_handle, "restart_counter", restart_counter); 55 | printf((err != ESP_OK) ? "Failed!\n" : "Done\n"); 56 | 57 | // Commit written value. 58 | // After setting any values, nvs_commit() must be called to ensure changes are written 59 | // to flash storage. Implementations may write to storage at other times, 60 | // but this is not guaranteed. 61 | printf("Committing updates in NVS ... "); 62 | err = nvs_commit(my_handle); 63 | printf((err != ESP_OK) ? "Failed!\n" : "Done\n"); 64 | 65 | // Close 66 | nvs_close(my_handle); 67 | } 68 | 69 | printf("\n"); 70 | return rst_time; 71 | } 72 | 73 | void record_wifi(char *ssid, char *password) 74 | { 75 | 76 | // 初始化NVS,并检查初始化情况 77 | esp_err_t err = nvs_flash_init(); 78 | if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) 79 | { 80 | // 如果NVS分区被占用则对其进行擦除 81 | // 并再次初始化 82 | ESP_ERROR_CHECK(nvs_flash_erase()); 83 | err = nvs_flash_init(); 84 | } 85 | ESP_ERROR_CHECK(err); 86 | 87 | // Open 打开NVS文件 88 | printf("\n"); 89 | printf("Opening Non-Volatile Wifi (NVS) handle... "); 90 | nvs_handle my_handle; // 定义不透明句柄 91 | err = nvs_open("Wifi", NVS_READWRITE, &my_handle); // 打开文件 92 | if (err != ESP_OK) 93 | { 94 | printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err)); 95 | } 96 | else 97 | { 98 | printf("Done\n"); 99 | 100 | // Write 101 | printf("Updating ssid in NVS ... "); 102 | err = nvs_set_str(my_handle, "ssid", ssid); 103 | printf((err != ESP_OK) ? "Failed!\n" : "Done\n"); 104 | 105 | printf("Updating password in NVS ... "); 106 | err = nvs_set_str(my_handle, "password", password); 107 | printf((err != ESP_OK) ? "Failed!\n" : "Done\n"); 108 | 109 | // Commit written value. 110 | // After setting any values, nvs_commit() must be called to ensure changes are written 111 | // to flash storage. Implementations may write to storage at other times, 112 | // but this is not guaranteed. 113 | printf("Committing updates in NVS ... "); 114 | err = nvs_commit(my_handle); 115 | printf((err != ESP_OK) ? "Failed!\n" : "Done\n"); 116 | 117 | // Close 118 | nvs_close(my_handle); 119 | } 120 | 121 | printf("\n"); 122 | } 123 | 124 | //检测ssid名称 125 | void check_wifi(char *ssid, char *password) 126 | { 127 | char saved_ssid[SSID_LENGTH]; 128 | size_t ssid_length = SSID_LENGTH; 129 | char saved_password[SSID_LENGTH]; 130 | size_t password_length = SSID_LENGTH; 131 | // 初始化NVS,并检查初始化情况 132 | esp_err_t err = nvs_flash_init(); 133 | if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) 134 | { 135 | // 如果NVS分区被占用则对其进行擦除 136 | // 并再次初始化 137 | ESP_ERROR_CHECK(nvs_flash_erase()); 138 | err = nvs_flash_init(); 139 | } 140 | ESP_ERROR_CHECK(err); 141 | 142 | // Open 打开NVS文件 143 | printf("\n"); 144 | printf("Opening Non-Volatile Wifi (NVS) handle... \n"); 145 | nvs_handle my_handle; // 定义不透明句柄 146 | err = nvs_open("Wifi", NVS_READWRITE, &my_handle); // 打开文件 147 | if (err != ESP_OK) 148 | { 149 | printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err)); 150 | } 151 | else 152 | { 153 | printf("Done\n"); 154 | 155 | // Read 156 | printf("Reading ssid and password from NVS ... \n"); 157 | 158 | err = nvs_get_str(my_handle, "ssid", saved_ssid, &ssid_length); 159 | switch (err) 160 | { 161 | case ESP_OK: 162 | printf("Done\n"); 163 | printf("ssid: %s\n", saved_ssid); 164 | printf("ssid length= %d\n", ssid_length); 165 | strcpy(ssid, saved_ssid); 166 | break; 167 | case ESP_ERR_NVS_NOT_FOUND: 168 | printf("The value is not initialized yet!\n"); 169 | break; 170 | default: 171 | printf("Error (%s) reading!\n", esp_err_to_name(err)); 172 | } 173 | 174 | err = nvs_get_str(my_handle, "password", saved_password, &password_length); 175 | switch (err) 176 | { 177 | case ESP_OK: 178 | printf("Done\n"); 179 | printf("password: %s\n", saved_password); 180 | printf("password length= %d\n", password_length); 181 | strcpy(password, saved_password); 182 | break; 183 | case ESP_ERR_NVS_NOT_FOUND: 184 | printf("The value is not initialized yet!\n"); 185 | break; 186 | default: 187 | printf("Error (%s) reading!\n", esp_err_to_name(err)); 188 | } 189 | 190 | // Close 191 | nvs_close(my_handle); 192 | } 193 | 194 | printf("\n"); 195 | return; 196 | } 197 | 198 | void ap_init() 199 | { 200 | //WiFi.softAP(ssid, password); 201 | WiFi.softAP("Makerfabs_ap"); 202 | IPAddress myIP = WiFi.softAPIP(); 203 | Serial.print("AP IP address: "); 204 | Serial.println(myIP); 205 | server.begin(); 206 | } 207 | 208 | int wifi_config_server() 209 | { 210 | 211 | WiFiClient client = server.available(); // listen for incoming clients 212 | 213 | if (client) // if you get a client, 214 | { 215 | Serial.println("---------------------------------------------------"); 216 | Serial.printf("Index:%d\n", client_count); 217 | client_count++; 218 | Serial.println("New Client."); // print a message out the serial port 219 | String currentLine = ""; // make a String to hold incoming data from the client 220 | while (client.connected()) 221 | { // loop while the client's connected 222 | if (client.available()) 223 | { // if there's bytes to read from the client, 224 | char c = client.read(); // read a byte, then 225 | Serial.write(c); // print it out the serial monitor 226 | if (c == '\n') 227 | { // if the byte is a newline character 228 | 229 | // if the current line is blank, you got two newline characters in a row. 230 | // that's the end of the client HTTP request, so send a response: 231 | if (currentLine.length() == 0) 232 | { 233 | // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK) 234 | // and a content-type so the client knows what's coming, then a blank line: 235 | client.println("HTTP/1.1 200 OK"); 236 | client.println("Content-type:text/html"); 237 | client.println(); 238 | 239 | // the content of the HTTP response follows the header: 240 | client.print("

Makerfabs


ESP32 WIFI CONFIG


"); 241 | client.print("Click here to set WIFI.
"); 242 | 243 | // The HTTP response ends with another blank line: 244 | client.println(); 245 | // break out of the while loop: 246 | break; 247 | } 248 | else 249 | { // if you got a newline, then clear currentLine: 250 | currentLine = ""; 251 | } 252 | } 253 | else if (c != '\r') 254 | { // if you got anything else but a carriage return character, 255 | currentLine += c; // add it to the end of the currentLine 256 | } 257 | //show wifiset page 258 | if (currentLine.endsWith("GET /wifi_set")) 259 | { 260 | // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK) 261 | // and a content-type so the client knows what's coming, then a blank line: 262 | client.println("HTTP/1.1 200 OK"); 263 | client.println("Content-type:text/html"); 264 | client.println(); 265 | 266 | client.print("

Makerfabs


ESP32 WIFI CONFIG


"); 267 | client.print("
SSID:

PASSWORD:


"); 268 | client.print("
"); 269 | // The HTTP response ends with another blank line: 270 | client.println(); 271 | // break out of the while loop: 272 | break; 273 | } 274 | 275 | if (currentLine.endsWith("GET /set_over")) 276 | { 277 | String get_request = ""; 278 | //read GET next line 279 | while (1) 280 | { 281 | char c_get = client.read(); 282 | Serial.write(c_get); 283 | if (c_get == '\n') 284 | { 285 | break; 286 | } 287 | else 288 | { 289 | get_request += c_get; 290 | } 291 | } 292 | 293 | //set_wifi_from_url(server.uri()); 294 | set_wifi_from_url(get_request); 295 | 296 | client.println("HTTP/1.1 200 OK"); 297 | client.println("Content-type:text/html"); 298 | client.println(); 299 | 300 | client.print("

Makerfabs


ESP32 WIFI CONFIG


"); 301 | client.print("Set Successful
"); 302 | client.println(); 303 | 304 | client.stop(); 305 | Serial.println("Client Disconnected."); 306 | 307 | return 0; 308 | } 309 | } 310 | } 311 | // close the connection: 312 | client.stop(); 313 | Serial.println("Client Disconnected."); 314 | } 315 | return 1; 316 | } 317 | 318 | void set_wifi_from_url(String get_url) 319 | { 320 | //get_url = "http://192.168.4.1/set_over?ssid=Makerfabs&password=20160704" 321 | int str_len = 0; 322 | int ssid_add = 0; 323 | int pwd_add = 0; 324 | int end_add = 0; 325 | 326 | String ssid = ""; 327 | String pwd = ""; 328 | 329 | str_len = get_url.length(); 330 | ssid_add = get_url.indexOf('?'); 331 | pwd_add = get_url.indexOf('&'); 332 | end_add = get_url.indexOf(' '); 333 | 334 | ssid = get_url.substring(ssid_add + 6, pwd_add); 335 | pwd = get_url.substring(pwd_add + 10, end_add); 336 | 337 | Serial.println(); 338 | Serial.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); 339 | Serial.println("Get ssid and password from url:"); 340 | Serial.println(get_url); 341 | Serial.println(ssid); 342 | Serial.println(pwd); 343 | Serial.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); 344 | 345 | record_wifi((char *)ssid.c_str(), (char *)pwd.c_str()); 346 | } 347 | 348 | // int wifi_set_main() 349 | // { 350 | // char ssid[SSID_LENGTH]; 351 | // char password[SSID_LENGTH]; 352 | // pinMode(WIFI_SET_PIN, INPUT_PULLUP); 353 | 354 | // check_wifi(ssid, password); 355 | // if (strcmp(ssid, "NULL") == 0 ) 356 | // { 357 | // //检查SSID是否为NULL 358 | // Serial.println("Check SSID is NULL,please connect \"Makerfabs_ap\"."); 359 | // Serial.println("And visit 192.168.4.1 to set WIFI."); 360 | // ap_init(); 361 | // while (wifi_config_server()) 362 | // ; 363 | 364 | // //设置完成后休眠3秒重启 365 | // delay(3000); 366 | // esp_restart(); 367 | // } 368 | // else 369 | // { 370 | // //3秒内拉低WIFI_SET_PIN则恢复出场设置并重启 371 | // Serial.println("Check WIFI_SET_PIN"); 372 | // int runtime = millis(); 373 | // int starttime = runtime; 374 | // while ((runtime - starttime) < 3000) 375 | // { 376 | // if (digitalRead(WIFI_SET_PIN) == LOW) 377 | // { 378 | // Serial.println("Init WIFI to default \"NULL\""); 379 | // record_wifi("NULL", "NULL0000"); 380 | // delay(1000); 381 | // esp_restart(); 382 | // } 383 | // Serial.print("."); 384 | // delay(100); 385 | // runtime = millis(); 386 | // } 387 | // Serial.println(); 388 | 389 | // //Connect wifi 390 | // Serial.println("Connecting WIFI"); 391 | // WiFi.begin(ssid, password); 392 | 393 | // int connect_count = 0; 394 | 395 | // //10S未连接上自动跳过并返回0 396 | // while (WiFi.status() != WL_CONNECTED) 397 | // { 398 | // delay(500); 399 | // Serial.print("."); 400 | // connect_count++; 401 | // if(connect_count > 10) 402 | // return 0; 403 | // } 404 | 405 | // // 成功连接上WIFI则输出IP并返回1 406 | // Serial.println(""); 407 | // Serial.println("WiFi connected"); 408 | // Serial.println("IP address: "); 409 | // Serial.println(WiFi.localIP()); 410 | 411 | // return 1; 412 | // } 413 | // } 414 | 415 | int wifi_set_main() 416 | { 417 | char ssid[SSID_LENGTH]; 418 | char password[SSID_LENGTH]; 419 | pinMode(WIFI_SET_PIN, INPUT_PULLUP); 420 | 421 | check_wifi(ssid, password); 422 | 423 | //3秒内拉低WIFI_SET_PIN则恢复出场设置并重启 424 | Serial.println("Check WIFI_SET_PIN"); 425 | int runtime = millis(); 426 | int starttime = runtime; 427 | while ((runtime - starttime) < 3000) 428 | { 429 | if (digitalRead(WIFI_SET_PIN) == LOW) 430 | { 431 | 432 | Serial.println("Please connect \"Makerfabs_ap\"."); 433 | Serial.println("And visit 192.168.4.1 to set WIFI."); 434 | ap_init(); 435 | while (wifi_config_server()) 436 | ; 437 | delay(3000); 438 | esp_restart(); 439 | return 0; 440 | } 441 | Serial.print("."); 442 | delay(100); 443 | runtime = millis(); 444 | } 445 | Serial.println(); 446 | 447 | //Connect wifi 448 | Serial.println("Connecting WIFI"); 449 | WiFi.begin(ssid, password); 450 | 451 | int connect_count = 0; 452 | 453 | //10S未连接上自动跳过并返回0 454 | while (WiFi.status() != WL_CONNECTED) 455 | { 456 | delay(500); 457 | Serial.print("."); 458 | connect_count++; 459 | if (connect_count > 10) 460 | return 0; 461 | } 462 | 463 | // 成功连接上WIFI则输出IP并返回1 464 | Serial.println(""); 465 | Serial.println("WiFi connected"); 466 | Serial.println("IP address: "); 467 | Serial.println(WiFi.localIP()); 468 | 469 | return 1; 470 | } 471 | 472 | void nvs_test() 473 | { 474 | char ssid[SSID_LENGTH] = ""; 475 | char password[SSID_LENGTH] = ""; 476 | int rst_time = 0; 477 | 478 | check_wifi(ssid, password); 479 | rst_time = record_rst_time(); 480 | 481 | sprintf(ssid, "ssid_%d", rst_time); 482 | sprintf(password, "password_%d", rst_time); 483 | 484 | record_wifi(ssid, password); 485 | 486 | // Restart module 487 | for (int i = 10; i >= 0; i--) 488 | { 489 | printf("Restarting in %d seconds...\n", i); 490 | vTaskDelay(1000 / portTICK_PERIOD_MS); 491 | } 492 | printf("Restarting now.\n"); 493 | fflush(stdout); 494 | esp_restart(); 495 | } -------------------------------------------------------------------------------- /Arduino_ESP32/arduino_example/wifi_set_demo/wifi_save.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Author : Vincent 4 | Create : 2021/2/5 5 | 6 | if ESP32开机检测SSID == NULL: 7 | ESP32通过AP模式,访问192.168.4.1进行修改,获得SSID和PASSWORD 8 | 通过NVS存储到FLASH中 9 | 重启 10 | else: 11 | 根据FLASH的SSID和PASSWORD连接wifi 12 | 13 | while 重启五秒内 && 重置按键被按下 : 14 | 将NVS设置为NULL 15 | 重启 16 | 17 | 用户程序() 18 | 19 | */ 20 | 21 | 22 | #include 23 | #include 24 | #include "freertos/FreeRTOS.h" 25 | #include "freertos/task.h" 26 | #include "esp_system.h" 27 | #include "nvs_flash.h" 28 | #include "nvs.h" 29 | 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #define SSID_LENGTH 40 36 | 37 | #define WIFI_SET_PIN 21 38 | 39 | int record_rst_time(); 40 | void nvs_test(); 41 | void record_wifi(char *ssid, char *password); 42 | void check_wifi(char *ssid, char *password); 43 | 44 | void ap_init(); 45 | int wifi_config_server(); 46 | void set_wifi_from_url(String get_url); 47 | int wifi_set_main(); -------------------------------------------------------------------------------- /Arduino_ESP32/arduino_example/wifi_set_demo/wifi_set_demo.ino: -------------------------------------------------------------------------------- 1 | #include "wifi_save.h" 2 | 3 | void setup() 4 | { 5 | Serial.begin(115200); 6 | if (wifi_set_main()) 7 | { 8 | Serial.println("Connect WIFI SUCCESS"); 9 | } 10 | else 11 | { 12 | Serial.println("Connect WIFI FAULT"); 13 | } 14 | } 15 | 16 | void loop() 17 | { 18 | Serial.println("loop"); 19 | delay(3000); 20 | } 21 | -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/arduino_esp32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/arduino_esp32.png -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/board_install.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/board_install.jpg -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/complair_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/complair_option.png -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/library.png -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/normal_esp32.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/normal_esp32.jpg -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/zip_lib-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/zip_lib-2.png -------------------------------------------------------------------------------- /Arduino_ESP32/md_pic/zip_lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_ESP32/md_pic/zip_lib.png -------------------------------------------------------------------------------- /Arduino_ESP32/readme.md: -------------------------------------------------------------------------------- 1 | # Arduino_ESP32 Usage 2 | 3 | ```c++ 4 | /* 5 | Version: V2.0 6 | Author: Vincent 7 | Create Date: 2020/9/12 8 | Update Date: 2021/2/7 9 | Note: 10 | 11 | 2021/2/7 V2.0 :Add a general WIFI set funtion. 12 | */ 13 | ``` 14 | 15 | [toc] 16 | 17 | # Overview 18 | 19 | Described how to develop ESP32 under the Arduino IDE. For MakePython and ESP32 serial. 20 | 21 | Includes: 22 | 23 | - Install development board 24 | - Install library 25 | - Compile options 26 | - Demo : Set WIFI 27 | 28 | # Install Board 29 | 30 | Arduino is supported in Espressif's products like ESP32. But need intall first. 31 | 32 | - Open Arduino IDE 33 | 34 | - Select "File", select "preferences". 35 | - In the Preferences window, select "Additional Boards Manager URLs" 36 | 37 | ![arduino_esp32](md_pic/arduino_esp32.png) 38 | 39 | - Add url : 40 | 41 | ```c++ 42 | https://dl.espressif.com/dl/package_esp32_index.json 43 | ``` 44 | 45 | - Select "Tools", select "board", select "Boards Manager". 46 | - Open Boards Manager as the screen snap below. 47 | 48 | - Search “esp32” in "Boards Manager" and install it. 49 | 50 | ![board_install](md_pic/board_install.jpg) 51 | 52 | 53 | 54 | # Install Library 55 | 56 | Most popular third-party libraries can be found in the library manager.For third-party libraries that are only uploaded to Github, you can install them by installing the ZIP library.You can also simply unzip to the Arduino library folder. 57 | 58 | ## Library Manager 59 | 60 | Arduino has its own library manager, and for some authenticated third-party libraries, it can be searched in the library manager. Click install. Common libraries such as SSD1306. 61 | 62 | - Select "Tools", select "Manage Libraries" 63 | 64 | - Search libraries which you need. 65 | 66 | ![manage_library](md_pic/library.png) 67 | 68 | ## Install Zip Library 69 | 70 | Some of the libraries downloaded manually or provided with the project will come with a ZIP archive.You can add it through the capabilities of the Arduino IDE's import ZIP library. 71 | 72 | - Select "Skecth", select "Include Library", select "Add ZIP library..." 73 | 74 | ![zip](md_pic/zip_lib.png) 75 | 76 | ## Unzip To Arduino Library Floder 77 | 78 | Or you can just unzip and copy the folder to the Arduino library folder.Usually the location is "C:\Users\yourname\Documents\Arduino\libraries". 79 | 80 | ![zip](md_pic/zip_lib-2.png) 81 | 82 | 83 | 84 | # Compile Options 85 | 86 | Most projects provide detailed compilation options, depending on the project. 87 | 88 | - You can choose ESP32 DEV in most cases, and the rest of the configuration takes the default. 89 | 90 | ![](md_pic/normal_esp32.jpg) 91 | 92 | - ESP32 WROVER has a large memory, so for projects with ESP32 Serial you can generally use this following compile options. 93 | 94 | ![complair_option2](md_pic/complair_option.png) 95 | 96 | # Upload 97 | 98 | Just select port and push upload... 99 | 100 | **Make sure connect with USB cable.** 101 | 102 | 103 | 104 | # Set WIFI 105 | 106 | We provide a header file and function for setting WIFI. 107 | 108 | Code is in : /Makerfabs_FAQ/Arduino_ESP32/arduino_example/wifi_set_demo/ 109 | 110 | ## LOGIC 111 | 112 | Chinese: 113 | 114 | ``` C 115 | if ESP32开机检测SSID == NULL: 116 | ESP32通过AP模式,访问192.168.4.1进行修改,获得SSID和PASSWORD 117 | 通过NVS存储到FLASH中 118 | 重启 119 | else: 120 | 根据FLASH的SSID和PASSWORD连接wifi 121 | 122 | while 重启五秒内 && 重置按键被按下 : 123 | 将NVS设置为NULL 124 | 重启 125 | 126 | if WIFI连接成功:1?0 127 | 128 | 用户程序() 129 | ``` 130 | 131 | English: 132 | 133 | ```c 134 | wifi_set_main(): 135 | if check SSID == NULL: 136 | ESP32 into AP method, Visit 192.168.4.1 to set SSID and PASSWORD 137 | via NVS save to FLASH 138 | ESP32 reboot 139 | else: 140 | use SSID and PASSWORD in FLASH to connect wifi 141 | 142 | while in 5s timeout && write WIFI_SET_PIN low: 143 | set ssid in Flash to "NULL" 144 | ESP32 reboot 145 | 146 | return WIFI connect success:1?0 147 | 148 | usercode() 149 | ``` 150 | 151 | 152 | 153 | ## How To Use 154 | 155 | - Upload Code to ESP32 156 | - Push WIFI_SET_BUTTON or set WIFI_SET_PIN(21) to LOW. 157 | - Then esp32 will reboot 158 | - Check your phone, you will found an AP named "Makerfabs_ap" 159 | - Connect it with your smartphone or PC. 160 | - Visit 192.168.4.1, and a setting page will show. 161 | - Use webpage set ssid and password, and it will auto reboot. 162 | - And ESP32 will connect WIFI after reboot. -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/board_install.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/board_install.jpg -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/cp2104-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/cp2104-2.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/cp2104.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/cp2104.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/library.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/pro.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/zero-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/zero-2.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/zip_lib-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/zip_lib-2.png -------------------------------------------------------------------------------- /Arduino_Maduino/md_pic/zip_lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/Arduino_Maduino/md_pic/zip_lib.png -------------------------------------------------------------------------------- /Arduino_Maduino/readme.md: -------------------------------------------------------------------------------- 1 | # Arduino_Maduino Usage 2 | 3 | ```c++ 4 | /* 5 | Version: V1.0 6 | Author: Vincent 7 | Create Date: 2020/9/12 8 | Update Date: 2020/9/12 9 | Note: 10 | */ 11 | ``` 12 | 13 | [toc] 14 | 15 | # Overview 16 | 17 | Described how to develop Maduino under the Arduino IDE. 18 | 19 | Includes: 20 | 21 | - Install development board 22 | - Install library 23 | - Compile options 24 | - Connect to pc 25 | 26 | # Install Board 27 | 28 | There are many types of Maduino , all based on the Arduino series. For example, Pro Mini and UNO are the default support for the Arduino IDE. But Zero needs to be installed. 29 | 30 | - Open Arduino IDE 31 | - Select "Tools", select "board", select "Boards Manager". 32 | - Open Boards Manager as the screen snap below. 33 | 34 | - Search “SAMD” in "Boards Manager" and install it. 35 | 36 | ![board_install](md_pic/board_install.jpg) 37 | 38 | 39 | 40 | # Install Library 41 | 42 | Most popular third-party libraries can be found in the library manager. For third-party libraries that are only uploaded to Github, you can install them by installing the ZIP library. You can also simply unzip to the Arduino library folder. 43 | 44 | ## Library Manager 45 | 46 | Arduino has its own library manager, and for some authenticated third-party libraries, it can be searched in the library manager. Click install. Common libraries such as SSD1306. 47 | 48 | - Select "Tools", select "Manage Libraries" 49 | 50 | - Search libraries which you need. 51 | 52 | ![manage_library](md_pic/library.png) 53 | 54 | ## Install Zip Library 55 | 56 | Some of the libraries downloaded manually or provided with the project will come with a ZIP archive. You can add it through the capabilities of the Arduino IDE's import ZIP library. 57 | 58 | - Select "Skecth", select "Include Library", select "Add ZIP library..." 59 | 60 | ![zip](md_pic/zip_lib.png) 61 | 62 | ## Unzip To Arduino Library Floder 63 | 64 | Or you can just unzip and copy the folder to the Arduino library folder. Usually the location is "C:\Users\yourname\Documents\Arduino\libraries". 65 | 66 | ![zip](md_pic/zip_lib-2.png) 67 | 68 | 69 | 70 | # Compile Options 71 | 72 | Most projects provide detailed compilation options, depending on the project. 73 | 74 | - Such like LoRa Relay(Arduino Pro Mini 3.3V) 75 | 76 | ![pro](md_pic/pro.png) 77 | 78 | - Such like Maduino Zero A9G(Arduino Zero) 79 | 80 | ![zero-2](md_pic/zero-2.png) 81 | 82 | # Connect To PC 83 | 84 | Some models have USB ports, and some smaller sensors don't. Here's how it works. 85 | 86 | ## With Micro USB 87 | 88 | USB integrated CP2104 or other types of serial port chips, no additional converter, directly through the USB cable to connect the serial port. It is used in the same way as the standard Arduino. 89 | 90 | ## With UART 91 | 92 | There is no USB socket or integrated serial port chip on some modules. But there are serial ports: VCC, GND, RX, TX, DTR. There are two ways to connect a serial port. 93 | 94 | ### MakerFabs CP2104 USB2UART 95 | 96 | Product link : [CP2104 USB2UART](https://www.makerfabs.com/cp2104-usb-to-serial-converter.html) 97 | 98 | ![cp2104](md_pic/cp2104.png) 99 | 100 | This CP2104 USB to Serial Converter is super tiny, a highly-integrated USB-to-UART Bridge Controller providing a simple solution for updating and programming. 101 | 102 | The serial port module has the same pin position as the makerfabs module with no USB port.So just plug it into the hole. 103 | 104 | ![cp2104](md_pic/cp2104-2.png) 105 | 106 | The usage of usb cable is the same after that. 107 | 108 | ### CP2102 MODULES USB TO TTL 109 | 110 | There are many common usb serial port modules on the market, which are basically connected in a common way. 111 | 112 | | Makerfabs | USB To TTL | 113 | | --------- | ---------- | 114 | | VCC | 3.3V | 115 | | GND | GND | 116 | | RX | TXD | 117 | | TX | RXD | 118 | 119 | # Upload 120 | 121 | Just select port and push upload... 122 | 123 | **Make sure connect with USB cable.** -------------------------------------------------------------------------------- /MaESP/md_pic/pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic1.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic10.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic11.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic2.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic3.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic4.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic5.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic6.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic7.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic8.jpg -------------------------------------------------------------------------------- /MaESP/md_pic/pic9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MaESP/md_pic/pic9.jpg -------------------------------------------------------------------------------- /MaESP/readme.md: -------------------------------------------------------------------------------- 1 | # MakePython FAQ 2 | 3 | ```c 4 | /* 5 | Create :2022/4/3 6 | Author :Vincent 7 | Version :V1.0 8 | 9 | */ 10 | ``` 11 | 12 | 13 | 14 | [toc] 15 | # Install CP210X Driver 16 | Download and install UART-to-USB Driver from silabs. 17 | https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers 18 | 19 | # Thonny IDE Install and Set 20 | ## Download and Install 21 | Download URL : 22 | https://thonny.org/ 23 | 24 | Select next until setup finish. 25 | 26 | ![](md_pic/pic1.jpg) 27 | 28 | ![](md_pic/pic2.jpg) 29 | 30 | Finish. 31 | ## Language and Board set 32 | Open Thonny. 33 | Select “Tools”,“Options” 34 | The Settings window pops up, and in the first tab, "General," there are language Settings. 35 | 36 | ![](md_pic/pic3.jpg) 37 | 38 | After setting, please restart Thonny. 39 | 40 | Select the second column interpreter and select the development board and port. Choose MicroPython(ESP32) for ESP32 and MicroPython(Raspberry Pi Pico) for Pico 41 | 42 | ![](md_pic/pic4.jpg) 43 | 44 | 45 | To select a port, Auto is recommended. 46 | 47 | # Usage 48 | 49 | ## Firmware Burn 50 | 51 | Go to the previous setup development board Settings page and select "Install or Update firmware" in the lower right corner. 52 | 53 | Download the firmware from the MicroPython website:[https://micropython.org/download/esp32/](https://micropython.org/download/esp32/) 54 | 55 | Select the port and bin file, and select Install. 56 | 57 | ![](md_pic/pic5.jpg) 58 | 59 | ## Connect 60 | 61 | After connecting with the USB cable, click the red STOP button. 62 | 63 | Make sure to use a USB cable that can transfer data. Some USB cables can only be charged. 64 | 65 | ![](md_pic/pic6.jpg) 66 | 67 | When the shell displays the MicroPython text prompt, the connection is successful. 68 | 69 | ![](md_pic/pic8.jpg) 70 | 71 | Sometimes when you click STOP several times and still can't connect, it means that the program is stuck in a loop. 72 | 73 | Click the part of the SHELL with the mouse to display the cursor, then press CTRL+C repeatedly to exit the program and connect. 74 | 75 | ![](md_pic/pic9.jpg) 76 | 77 | ## Software Upload 78 | 79 | There is a file box on the left of the interface. If it is not displayed after the installation, select "View" on the toolbar and select "File". 80 | 81 | ![](md_pic/pic10.jpg) 82 | 83 | The location of files in the file box is clickable. At present, you can only enter the folder where you put the program through this method. 84 | 85 | Right-click the program you want to upload to ESP32 and select "Upload to /". 86 | 87 | ## Batch upload 88 | 89 | Hold down SHIFT to select all programs in the file, right click, and select "Upload to /" to batch upload. 90 | 91 | ![](md_pic/pic7.jpg) 92 | 93 | If there is a program before, it will prompt you whether to overwrite, select OK. 94 | 95 | ![](md_pic/pic11.jpg) 96 | 97 | -------------------------------------------------------------------------------- /MakePython/md_pic/burn_firmware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/burn_firmware.png -------------------------------------------------------------------------------- /MakePython/md_pic/default_run.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/default_run.jpg -------------------------------------------------------------------------------- /MakePython/md_pic/upy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy1.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy2.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy3.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy4.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy5.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy6.png -------------------------------------------------------------------------------- /MakePython/md_pic/upy7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/md_pic/upy7.png -------------------------------------------------------------------------------- /MakePython/micropython-bin/esp32-idf3-20191220-v1.12.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makerfabs/Makerfabs_FAQ/4c97f08f1e8af1353e290906190443bb8addf0cc/MakePython/micropython-bin/esp32-idf3-20191220-v1.12.bin -------------------------------------------------------------------------------- /MakePython/readme.md: -------------------------------------------------------------------------------- 1 | # MakePython Usage 2 | 3 | ```c++ 4 | /* 5 | Version: V1.0 6 | Author: Vincent 7 | Create Date: 2020/9/12 8 | Update Date: 2020/9/12 9 | Note: 10 | */ 11 | ``` 12 | 13 | [toc] 14 | 15 | # Overview 16 | 17 | Described how to develop ESP32 under the uPyCraft IDE. For MakePython and ESP32 serial. 18 | 19 | Includes: 20 | 21 | - How to use uPyCraft 22 | - Upload codes 23 | 24 | 25 | 26 | # uPyCraft IDE 27 | 28 | - Click this link to download uPyCraft IDE for Windows: : [uPyCraft_win](https://randomnerdtutorials.com/uPyCraftWindows) 29 | - Double-click to open uPyCraft. 30 | 31 | ![uPyCraft](md_pic/upy.png) 32 | 33 | - Select "Tools",select "board", select "esp32" or "esp8266".It depends on the model you're using. 34 | 35 | ![upy1](md_pic/upy1.png) 36 | 37 | - Select "Tools",select "InitConfig" to reset workspace address. 38 | - Click workSpace, and select the project folder. 39 | 40 | ![upy2](md_pic/upy2.png) 41 | 42 | - The program files must be placed in the workSpace folder of the project folder. 43 | - Select "File", select "Reflush Directroy". 44 | 45 | ![upy2](md_pic/upy3.png) 46 | 47 | 48 | 49 | - The Python files in the folder will be displayed on the left. 50 | 51 | ![upy2](md_pic/upy4.png) 52 | 53 | 54 | 55 | # UPyCraft Upload 56 | 57 | - Connect MakePython ESP32 to your PC, open uPyCraft, and select connect to the serial port. 58 | 59 | ![upy2](md_pic/upy5.png) 60 | 61 | - If there is no port to display, you need to download the USB driver. [CP210x driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) 62 | - Get a MicroPython fireware from [micropython.org](http://www.micropython.org/download/esp32/) 63 | - Firmware will be prompted if it has not been burned before or for other reasons.Board selects ESP32, BURN_addr selects 0x1000, Erase_Flash selects Yes, com selects the port number. Firmware Choose Users, click Choose to Choose ESP32-IDF3-20190125-v1.10.bin.(Or other esp32 micropython bin) 64 | 65 | ![burn_esp32](md_pic/burn_firmware.png) 66 | 67 | - If you burn the firmware, you need to click connect again. 68 | 69 | - Download all python programs in workSpace to ESP32. 70 | 71 | ![upy7](md_pic/upy7.png) 72 | 73 | - You can also hold down the left mouse button and drag files from the workSpace into Device. 74 | 75 | ![upy2](md_pic/upy6.png) 76 | 77 | - Press the RST button on ESP32 to reset the development board. 78 | 79 | - Some projects do not provide main.py and need to set the main program entry manually. Right-click to select the file in Device that needs to be started up and select "Default Run". 80 | 81 | ![default_run](md_pic/default_run.jpg) -------------------------------------------------------------------------------- /pins_define/makerfabs_pin.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------- 3 | titile : Makerfabs IO define 4 | author : Vincent 5 | create : 2020/9/4 6 | version : 1.4 7 | update : 2020/11/17 8 | 9 | Note: 10 | v1.0 : Create Project. 11 | v1.1 : Add MakePython Audio support. 12 | v1.2 : Ass MakePython A9G support. 13 | v1.3 : Add A9G and ILI9341 support. 14 | v1.4 : Add MakePython Voice Card. 15 | 16 | 1. 17 | For easy use ESP32 GPIO,define SPI, I2C, and LCD, SDcard pins. 18 | And define some parameters, such as screen size. 19 | 20 | 2. 21 | Sigillum: 22 | MP = MakePython 23 | MP_ESP32 = MakePython ESP32 SSD1306 24 | MP_ESP32_COLOR = MakePython ESP32 Color LCD (ST7789) 25 | 26 | TSC = Touch Screen Camera 27 | ESP32_TSC_9488 = ESP32 Touch Screen Camera With ILI9488 28 | 29 | 3. 30 | //#define ESP32_COLOR_7789 OK 31 | "Ok" means tested and ready to use 32 | Don't use "ERR" or "TEST" 33 | 34 | 4. 35 | For the motherboard combination expansion board. 36 | This is to be determined and may be modified. 37 | A more prudent approach is to copy the pin value directly. 38 | 39 | ------------------------------------------------- 40 | Support List: 41 | 42 | (1)MakePython: 43 | MakePython ESP32 COLOR LCD 44 | MakePython ESP32 SSD1306 45 | MakePython Audio 46 | MakePython A9G 47 | MakePython Voice Card 48 | 49 | (2)Touch Screen Camera: 50 | ESP32 Touch Screen Camera With 9488 51 | ESP32 Touch Screen Camera With ILI9341 52 | 53 | ------------------------------------------------- 54 | */ 55 | 56 | //BOARD 57 | 58 | #define MP_ESP32 OK 59 | //#define MP_ESP32_COLOR OK 60 | //#define ESP32_TSC_9488 OK 61 | //#define ESP32_TSC_9341 OK 62 | 63 | //SHIELD 64 | //#define MP_AUDIO OK 65 | //#define MP_A9G OK 66 | #define MP_VOICE OK 67 | 68 | //****************************************************************************** 69 | 70 | /* 71 | update : 2020/9/8 72 | name : MakePython ESP32 SSD1306 73 | sigillum: MP_ESP32_COLOR 74 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_ESP32 75 | module : 76 | (1) 1.3inch OLED SSD1306 77 | 78 | */ 79 | #ifdef MP_ESP32 80 | 81 | #define MP_ESP32_FLASH_BUTTON 0 82 | 83 | //I2C 84 | #define MP_ESP32_I2C_SDA 4 85 | #define MP_ESP32_I2C_SCL 5 86 | 87 | //HSPI 88 | #define MP_ESP32_HSPI_MOSI 13 89 | #define MP_ESP32_HSPI_MISO 12 90 | #define MP_ESP32_HSPI_SCK 14 91 | #define MP_ESP32_HSPI_CS 15 92 | 93 | //VSPI 94 | #define MP_ESP32_VSPI_MOSI 23 95 | #define MP_ESP32_VSPI_MISO 19 96 | #define MP_ESP32_VSPI_SCK 18 97 | #define MP_ESP32_VSPI_CS 5 98 | 99 | //SSD1306 100 | #define MP_ESP32_SSD1306_I2C_ADDR 0x3C 101 | #define MP_ESP32_SSD1306_WIDTH 128 // OLED display width, in pixels 102 | #define MP_ESP32_SSD1306_HEIGHT 64 // OLED display height, in pixels 103 | #define MP_ESP32_SSD1306_RST -1 104 | 105 | #endif 106 | 107 | /* 108 | update : 2020/9/11 109 | name : MakePython ESP32 COLOR LCD 110 | sigillum: MP_ESP32_COLOR 111 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_ESP32_Color_LCD 112 | module : 113 | (1) 1.3inch TFT ST7789 driver 114 | 115 | */ 116 | #ifdef MP_ESP32_COLOR 117 | 118 | //I2C 119 | #define MP_ESP32_COLOR_I2C_SDA 4 120 | #define MP_ESP32_COLOR_I2C_SCL 5 121 | 122 | //HSPI 123 | #define MP_ESP32_COLOR_HSPI_MOSI 13 124 | #define MP_ESP32_COLOR_HSPI_MISO 12 125 | #define MP_ESP32_COLOR_HSPI_SCK 14 126 | #define MP_ESP32_COLOR_HSPI_CS 15 127 | 128 | //VSPI 129 | #define MP_ESP32_COLOR_VSPI_MOSI 23 130 | #define MP_ESP32_COLOR_VSPI_MISO 19 131 | #define MP_ESP32_COLOR_VSPI_SCK 18 132 | #define MP_ESP32_COLOR_VSPI_CS 5 133 | 134 | //ST7789 135 | #define MP_ESP32_COLOR_LCD_MOSI MP_ESP32_COLOR_HSPI_MOSI 136 | #define MP_ESP32_COLOR_LCD_MISO MP_ESP32_COLOR_HSPI_MISO 137 | #define MP_ESP32_COLOR_LCD_SCK MP_ESP32_COLOR_HSPI_SCK 138 | 139 | #define MP_ESP32_COLOR_LCD_CS 15 140 | 141 | #define MP_ESP32_COLOR_LCD_RST 21 142 | #define MP_ESP32_COLOR_LCD_DC 22 143 | #define MP_ESP32_COLOR_LCD_BL -1 //5 144 | 145 | #define MP_ESP32_COLOR_LCD_WIDTH 240 146 | #define MP_ESP32_COLOR_LCD_HEIGHT 240 147 | #define MP_ESP32_COLOR_LCD_SPI_HOST HSPI_HOST 148 | 149 | #endif 150 | 151 | /* 152 | update : 2020/9/22 153 | name : ESP32 Touch Screen Camera With ILI9488 154 | sigillum: ESP32_TSC_9488 155 | wiki : 156 | module : 157 | (1) 3.5inch TFT ILI9488 driver 158 | (2) SDcard Reader 159 | (3) I2C Touch Screen(NS2009 or Ft6236) 160 | (4) OV2640 Camera 161 | note : 162 | (1) In camera need VSPI, but actually use HSPI. Why? 163 | */ 164 | 165 | #ifdef ESP32_TSC_9488 166 | 167 | //I2C 168 | #define ESP32_TSC_9488_I2C_SDA 26 169 | #define ESP32_TSC_9488_I2C_SCL 27 170 | 171 | //SPI 172 | #define ESP32_TSC_9488_HSPI_MOSI 13 173 | #define ESP32_TSC_9488_HSPI_MISO 12 174 | #define ESP32_TSC_9488_HSPI_SCK 14 175 | #define ESP32_TSC_9488_HSPI_CS 15 176 | 177 | //ILI9488 178 | #define ESP32_TSC_9488_LCD_MOSI ESP32_TSC_9488_HSPI_MOSI 179 | #define ESP32_TSC_9488_LCD_MISO ESP32_TSC_9488_HSPI_MISO 180 | #define ESP32_TSC_9488_LCD_SCK ESP32_TSC_9488_HSPI_SCK 181 | 182 | #define ESP32_TSC_9488_LCD_CS 15 183 | 184 | #define ESP32_TSC_9488_LCD_RST 26 185 | #define ESP32_TSC_9488_LCD_DC 33 186 | #define ESP32_TSC_9488_LCD_BL -1 187 | 188 | #define ESP32_TSC_9488_LCD_WIDTH 320 189 | #define ESP32_TSC_9488_LCD_HEIGHT 480 190 | #define ESP32_TSC_9488_LCD_SPI_HOST VSPI_HOST //?? IF use HSPI, will wrong. 191 | 192 | //SDcard 193 | #define ESP32_TSC_9488_SD_MOSI ESP32_TSC_9488_HSPI_MOSI 194 | #define ESP32_TSC_9488_SD_MISO ESP32_TSC_9488_HSPI_MISO 195 | #define ESP32_TSC_9488_SD_SCK ESP32_TSC_9488_HSPI_SCK 196 | 197 | #define ESP32_TSC_9488_SD_CS 4 198 | 199 | #endif 200 | 201 | /* 202 | update : 2020/9/29 203 | name : ESP32 Touch Screen Camera With ILI9341 204 | sigillum: ESP32_TSC_9341 205 | wiki : 206 | module : 207 | (1) 3.2inch TFT ILI9341 driver 208 | (2) SDcard Reader 209 | (3) SPI Touch Screen(STMPE610) 210 | (4) OV2640 Camera 211 | */ 212 | 213 | #ifdef ESP32_TSC_9341 214 | 215 | 216 | //SPI 217 | #define ESP32_TSC_9341_SPI_MOSI 13 218 | #define ESP32_TSC_9341_SPI_MISO 12 219 | #define ESP32_TSC_9341_SPI_SCK 14 220 | 221 | //SD Card 222 | #define ESP32_TSC_9341_SD_CS 4 223 | 224 | //Touch Screen 225 | #define ESP32_TSC_9341_STMPE_CS 2 226 | 227 | //TFT 228 | #define ESP32_TSC_9341_LCD_CS 15 229 | 230 | #define ESP32_TSC_9341_LCD_DC 33 231 | #define ESP32_TSC_9341_LCD_BL -1 232 | #define ESP32_TSC_9341_LCD_RST -1 233 | 234 | #define ESP32_TSC_9341_LCD_WIDTH 320 235 | #define ESP32_TSC_9341_LCD_HEIGHT 240 236 | #define ESP32_TSC_9341_LCD_SPI_HOST VSPI_HOST 237 | 238 | //I2C 239 | #define ESP32_TSC_9341_SDA 26 240 | #define ESP32_TSC_9341_SCL 27 241 | 242 | #endif 243 | 244 | /* 245 | update : 2020/9/11 246 | name : MakePython ESP32 Audio 247 | sigillum: MP_AUDIO 248 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_Audio 249 | module : 250 | (1) audio jack(3.5mm) 251 | (2) SD Card 252 | (3) NXP Low power Audio DAC: uDA1334 253 | 254 | */ 255 | 256 | #ifdef MP_AUDIO 257 | 258 | //SD Card 259 | #define MP_AUDIO_SD_CS 22 260 | 261 | #if defined MP_ESP32 262 | #define MP_AUDIO_SPI_MOSI MP_ESP32_VSPI_MOSI 263 | #define MP_AUDIO_SPI_MISO MP_ESP32_VSPI_MISO 264 | #define MP_AUDIO_SPI_SCK MP_ESP32_VSPI_SCK 265 | 266 | #elif defined MP_ESP32_COLOR 267 | #define MP_AUDIO_SPI_MOSI MP_ESP32_COLOR_VSPI_MOSI 268 | #define MP_AUDIO_SPI_MISO MP_ESP32_COLOR_VSPI_MISO 269 | #define MP_AUDIO_SPI_SCK MP_ESP32_COLOR_VSPI_SCK 270 | 271 | #else 272 | #define MP_AUDIO_SPI_MOSI 23 273 | #define MP_AUDIO_SPI_MISO 19 274 | #define MP_AUDIO_SPI_SCK 18 275 | 276 | #endif 277 | 278 | //Digital I/O used //Makerfabs Audio V2.0 279 | #define MP_AUDIO_I2S_DOUT 27 280 | #define MP_AUDIO_I2S_BCLK 26 281 | #define MP_AUDIO_I2S_LRC 25 282 | 283 | //Button 284 | #define MP_AUDIO_Pin_vol_up 39 285 | #define MP_AUDIO_Pin_vol_down 36 286 | #define MP_AUDIO_Pin_mute 35 287 | #define MP_AUDIO_Pin_previous 15 288 | #define MP_AUDIO_Pin_pause 33 289 | #define MP_AUDIO_Pin_next 2 290 | 291 | #endif 292 | 293 | 294 | /* 295 | update : 2020/9/15 296 | name : MakePython A9G 297 | sigillum: MP_A9G 298 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_A9G 299 | module : 300 | (1) A9G 301 | (2) SD Card 302 | (3) SIM Card 303 | 304 | */ 305 | 306 | #ifdef MP_A9G 307 | 308 | //SD Card 309 | #define MP_A9G_SD_CS 32 310 | 311 | #if defined MP_ESP32 312 | #define MP_A9G_SPI_MOSI MP_ESP32_HSPI_MOSI 313 | #define MP_A9G_SPI_MISO MP_ESP32_HSPI_MISO 314 | #define MP_A9G_SPI_SCK MP_ESP32_HSPI_SCK 315 | 316 | #elif defined MP_ESP32_COLOR 317 | #define MP_A9G_SPI_MOSI MP_ESP32_COLOR_HSPI_MOSI 318 | #define MP_A9G_SPI_MISO MP_ESP32_COLOR_HSPI_MISO 319 | #define MP_A9G_SPI_SCK MP_ESP32_COLOR_HSPI_SCK 320 | 321 | #else 322 | #define MP_A9G_SPI_MOSI 13 323 | #define MP_A9G_SPI_MISO 12 324 | #define MP_A9G_SPI_SCK 14 325 | 326 | #endif 327 | 328 | 329 | #endif 330 | 331 | /* 332 | update : 2020/11/17 333 | name : MakePython ESP32 Voice Interaction Hat 334 | sigillum: MP_VOICE 335 | wiki : 336 | module : 337 | (1) audio jack(3.5mm) 338 | (2) SD Card 339 | (3) ADC and DAC: wm8960 340 | 341 | */ 342 | 343 | #ifdef MP_VOICE 344 | 345 | //SD Card 346 | #define MP_VOICE_SD_CS 22 347 | 348 | #if defined MP_ESP32 349 | #define MP_VOICE_SPI_MOSI MP_ESP32_VSPI_MOSI 350 | #define MP_VOICE_SPI_MISO MP_ESP32_VSPI_MISO 351 | #define MP_VOICE_SPI_SCK MP_ESP32_VSPI_SCK 352 | 353 | #elif defined MP_ESP32_COLOR 354 | #define MP_VOICE_SPI_MOSI MP_ESP32_COLOR_VSPI_MOSI 355 | #define MP_VOICE_SPI_MISO MP_ESP32_COLOR_VSPI_MISO 356 | #define MP_VOICE_SPI_SCK MP_ESP32_COLOR_VSPI_SCK 357 | 358 | #else 359 | #define MP_VOICE_SPI_MOSI 23 360 | #define MP_VOICE_SPI_MISO 19 361 | #define MP_VOICE_SPI_SCK 18 362 | 363 | #endif 364 | 365 | //Digital I/O used 366 | #define MP_VOICE_I2S_DOUT 27 367 | #define MP_VOICE_I2S_DIN 33 368 | #define MP_VOICE_I2S_BCLK 26 369 | #define MP_VOICE_I2S_LRC 25 370 | 371 | //Button 372 | #define MP_VOICE_Pin_vol_up 39 373 | #define MP_VOICE_Pin_vol_down 36 374 | #define MP_VOICE_Pin_mute 35 375 | 376 | #endif 377 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Makerfabs FAQ 2 | 3 | ```c++ 4 | /* 5 | Version: V4.0 6 | Author: Vincent 7 | Create Date: 2020/7/21 8 | Update Date: 2020/9/12 9 | Note: 10 | 2021/2/7 V4.0 : Change Arduino ESP 32 :Add a general WIFI set funtion. 11 | 2020/9/12 v3.0: Split the original documentation into different folders. 12 | 2020/9/8 V2.1: Add ESP32 example. 13 | 2020/9/4 V2.0: Add pins define for easy use. 14 | 2020/7/23 V1.1: Added maduino and Makepython methods for downloading programs. 15 | 16 | */ 17 | ``` 18 | 19 | [toc] 20 | 21 | # Overview 22 | 23 | This document shows how to use Makerfabs products. 24 | 25 | Answer frequently asked questions. 26 | 27 | Provide fast - developing sample and pin library maintenance. 28 | 29 | # How To Use? 30 | 31 | Makerfabs has three main product lines : 32 | - ESP32-based "MakePython" serial. 33 | - ESP32 serial. 34 | - Arduino-based "Maduino" serial. 35 | 36 | **It is used in different ways according to different serial products.** The use of the development board is described in detail in three folders : 37 | 38 | - **/Arduino_Maduino** : Based on traditional Arduino board like Arduino Pro Mini or Arduino Zero. 39 | - **/Arduino_ESP32** : Develop ESP32 with the Arduino IDE. 40 | - **/MakePython** : Develop ESP32 with MakePython . 41 | 42 | These folders explain how to do code burning for different modules, the simple configuration of the IDE. 43 | 44 | It also explains some development points caused by hardware inconsistencies, such as Pin-Settings. 45 | 46 | 47 | 48 | # GPIO/PINS 49 | 50 | Some modules have modified the default IO port due to wiring or onboard components. For example, I2C and SPI interfaces are different from standard Arduino and ESP32. 51 | 52 | In file "/Makerfabs_FAQ/pins_define/makerfabs_pin.h" support pins define. Use a copy of the project file under the reference file. And uncomment the board you are using. 53 | 54 | ```c++ 55 | //BOARD 56 | 57 | #define MP_ESP32 OK 58 | //#define MP_ESP32_COLOR OK 59 | //#define ESP32_TSC_9488 OK 60 | //#define ESP32_ILI9341 ERR don't use 61 | 62 | //SHIELD 63 | #define MP_AUDIO OK 64 | 65 | //****************************************************************************** 66 | 67 | /* 68 | update : 2020/9/8 69 | name : MakePython ESP32 SSD1306 70 | sigillum: MP_ESP32_COLOR 71 | wiki : https://www.makerfabs.com/wiki/index.php?title=MakePython_ESP32 72 | module : 73 | (1) 1.3inch OLED SSD1306 74 | 75 | */ 76 | #ifdef MP_ESP32 77 | 78 | #define MP_ESP32_FLASH_BUTTON 0 79 | 80 | //I2C 81 | #define MP_ESP32_I2C_SDA 4 82 | #define MP_ESP32_I2C_SCL 5 83 | ``` 84 | --------------------------------------------------------------------------------