alanlan86

  • 2023-12-07
  • 回复了主题帖: 【得捷电子Follow m3第3期】任务6:综合实践|圆屏点亮时钟界面

    wangerxian 发表于 2023-12-5 11:45 这圆屏的分辨率是多少?
    240×240 resolution 65K colors

  • 回复了主题帖: 【得捷电子Follow m3第3期】任务6:综合实践|圆屏点亮时钟界面

    Item        Detail Power Supply        USB Type-C: 5V @35 mA Battery Charge: 3.7V @37mA Charge current        ~ 485 mA Expandable memory        TF Card Slot for up to 32GB FAT Screen        1.28-inch touch screen 240×240 resolution 65K colors Other External Equipment        JST 1.25 connector Dimension        39mm x 39mm

  • 2023-12-05
  • 加入了学习《【DigiKey创意大赛】植物护理助手-Grove Arduino和Gravity WIFI module的结合》,观看 【DigiKey创意大赛】植物护理助手-Grove Arduino和Gravity WIFI module的结合

  • 2023-12-04
  • 发表了主题帖: 【得捷电子Follow m3第3期】任务6:综合实践|圆屏点亮时钟界面

    本帖最后由 alanlan86 于 2023-12-4 21:20 编辑 #准备 - 趁着Follow me 3期的物料,放弃了周边传感器(之前的几次活动+底板外设,传感器基本够用),因此果断入手圆屏扩展底板。 ![](https://files.seeedstudio.com/wiki/round_display_for_xiao/rounddisplay.jpg) - 当然核心板,还是Seeed Studio的ESP32-C3 XIAO ![](https://files.seeedstudio.com/wiki/round_display_for_xiao/xiaoesp32c3.jpg) - 有核心主控+底板,基本就是正确对接即可,不需要额外的硬件连接了。 #开发环境 ###闲话 - 关于开发环境,一开始想顺着官网wiki的步骤,用Arduino的IDE进行代码编写,但是实际操作时发现,如果不采用“科学上网”会让人很崩溃。因此,放弃Arduino IDE,改用VSCode+PlatformIO(之前玩过一个国产很冷门的8位单片机,简单用过它~~~当时缺实感到意外)。 ###增加库 - 有了platformIO,只需简单几步,将ESP32-C3的开发环境搭建完成,同时,将LVGL和TFT_eSPI库增加到工程,另外如果跑benchmark,需要下载lv_examples.需要RTC BM8563的驱动库。 ```html [env:seeed_xiao_esp32c3] platform = espressif32 board = seeed_xiao_esp32c3 framework = arduino ;lib_ldf_mode = deep+ lib_deps =         bodmer/TFT_eSPI@^2.5.34         lvgl/lvgl@^8.3.9         tanakamasayuki/I2C BM8563 RTC@^1.0.4         arduino-libraries/SD@^1.2.4         lvgl/lv_examples@^8.1.1-dev ``` ###入手笔记 [上手步骤](https://wiki.seeedstudio.com/get_start_round_display/ "上手步骤") ###注意事项 - 将TFT_eSPI的代码库下载之后,配置屏幕的驱动环境:User_Setup_Select.h,这一步不对的话,屏幕是不会有反应的!!! - 记得拷贝LVGL里面的lv_conf.h文件到库的对应路径 - 做lv_demo时候,需要下载lv_examples的库,不用默认自带的demos文件夹。 - example文件夹,在编译是不包含的,也有直接将其移入src的操作方法,但是感觉会打乱代码的结构~~~所以下载一下库好了! #软件代码 - 代码片段在参考的代码仓库,都非常详细了,此处简单贴一个代码片段。 [Seeed Arduino Round Display代码仓库](https://github.com/Seeed-Studio/Seeed_Arduino_RoundDisplay "Seeed Arduino Round Display代码仓库") ```cpp #include #include #define TEST_MODE  2 #if (TEST_MODE == 2) #include #endif // uncomment a library for display driver #define USE_TFT_ESPI_LIBRARY // #define USE_ARDUINO_GFX_LIBRARY #include "lv_xiao_round_screen.h" #if (TESTMODE == 1) #include "lv_hardware_test.h" #endif void setup() {     Serial.begin( 115200 );  //prepare for possible serial debug     Serial.println( "XIAO round screen - LVGL_Arduino" );     lv_init();     lv_xiao_disp_init();     lv_xiao_touch_init(); #if (TEST_MODE == 1)     lv_hardware_test(); #elif (TEST_MODE == 2)     // lv_demo_widgets();     lv_demo_benchmark();     // lv_demo_keypad_encoder();     // lv_demo_music();     // lv_demo_printer();     // lv_demo_stress(); #endif } void loop() {     lv_timer_handler();  //let the GUI do its work     delay( 5 ); } ``` #调试 - 工程代码编译成功 - 将固件upload到ESP32-C3板子 #演示 [localvideo]472439afa11b10f51dde6771cb4429a9[/localvideo] [localvideo]da94be49a5f59bf7b2cac7545687ac20[/localvideo] #后续 - 经过上面的上手,已经简单熟悉圆屏板子的玩法,接下来,抽些时间,用代码通过BLE实现一个简单的多媒体遥控按钮。 :Onion-3:最近工作太忙了,期望能挤出时间吧~~~

  • 2023-11-20
  • 加入了学习《【得捷电子Follow me第3期】智能家居之环境监测应用》,观看 任务6:综合实践之环境监测及应用

  • 2023-11-19
  • 发表了主题帖: 【得捷电子Follow m3第3期】任务6:综合实践|WiFi信号追踪

    #准备工作 - WiFi信号强度追踪,可直接参考:[WiFi RSSI Tracker](https://wiki.seeedstudio.com/XIAO_ESP32C3_MicroPython/ "WiFi RSSI Tracker") - ESP32-C3 XIAO开发板及扩展板一块 ![](https://files.seeedstudio.com/wiki/wiki-ranger/Contributions/C3-MicroPy/C3-MicroPython10.jpg) #硬件 - 外扩SSD1306的话,接入SCL=7 SDA=6 - 将2.4G WiFi天线接上 #软件 - 整改代码的过程,可以参看中文注释部分! ```python import network import time from time import sleep import machine from machine import Pin, SoftI2C import ssd1306 import math # ESP32C3 Pin assignment i2c = SoftI2C(scl=Pin(7), sda=Pin(6))  # Adjust the Pin numbers based on your connections oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) # Network settings wifi_ssid = "SSID-XXX"#替换为你的SSID wifi_password = "PASSWORD-XXX" #替换为你的PASSWORD machine.freq(160000000)  # Set CPU frequency to 160 MHz (ESP32 specific) oled.text("Starting up...", 0, 0) oled.show() #链接AP路由器 station = network.WLAN(network.STA_IF) station.active(True) station.connect(wifi_ssid, wifi_password) time.sleep(1) while not station.isconnected():     time.sleep(1) #显示正在链接 oled.fill(0) oled.text("Connecting to", 0, 0) oled.text(wifi_ssid, 0, 20) oled.show() time.sleep(2) #链接成功显示IP地址 oled.fill(0) ip_address = station.ifconfig()[0]  # Get the IP address oled.text("Connected! ", 0, 0) oled.text("IP Address:", 0, 20) oled.text(ip_address, 0, 40) oled.show() time.sleep(2) # Buzzer settings buzzer_pin = machine.Pin(5, machine.Pin.OUT) buzzer = machine.PWM(buzzer_pin) buzzer.freq(1047) buzzer.duty(0) center_x = oled_width // 2 center_y = oled_height // 2 square_size = 6  # Size of each square num_squares = 12  # Number of squares angle_increment = 2 * math.pi / num_squares x_pos = [12, 38, 64, 90] statuses = ["poor", "normal", "good", "excellent"] #根据RSSI显示信号强度方块 def calculate_block_count(rssi):     # Determine the number of blocks based on RSSI values     if -80

  • 回复了主题帖: 【得捷电子Follow me第3期】任务5:使用外部传感器|电阻测温度

    rhi 发表于 2023-11-19 12:49 为什么药使用LM358输出的温度传感器电压呢?直接采用热敏电阻,接上ADC采集电压,也可以算出温度啊,这样更 ...
    这个Grove的扩展模块,加358是做了一个电压跟随,增加输出阻抗啊。

  • 发表了主题帖: 【得捷电子Follow me第3期】任务5:使用外部传感器|电阻测温度

    #准备工作 - ESP32-C3 XIAO开发板一块 ![](https://files.seeedstudio.com/wiki/XIAO_WiFi/pin_map-2.png) - 测温传感器扩展板一块 ![](https://files.seeedstudio.com/wiki/Grove-Temperature_Sensor/img/Temperature1.jpg) - SSD1306 OLED扩展显示板 ![](https://files.seeedstudio.com/wiki/Grove-OLED-Display-0.96-SSD1315-/img/Grove-OLED-Displey-0.96-SSD1315-pin.jpg) #硬件 - 将温度传感器链接到GPIO2(A0/D0)引脚,输入电源VCC和GND - 关于温度扩展板的原理图可以获取:[温度传感器原理图](https://wiki.seeedstudio.com/Grove-Temperature_Sensor/ "温度传感器原理图") - OLED接入I2C SCL=7 SDA=6 #软件 - 通过ADC采集LM358输出的温度传感器电压,然后通过电压计算电阻值,并通过对数计算,得到温度值 ```python from machine import ADC from machine import Pin, SoftI2C import ssd1306 from time import sleep import time import math # ESP32 Pin assignment i2c = SoftI2C(scl=Pin(7), sda=Pin(6))  # Adjust the Pin numbers based on your connections oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) oled.fill(0) oled.text("Starting up...", 0, 0) oled.show() bValue=3975 adc = ADC(Pin(2))        # create an ADC object acting on a pin adc.atten(ADC.ATTN_11DB) adc.width(ADC.WIDTH_12BIT)  #4095 while True:     val = adc.read()     print("adc=", val)     # Transform the ADC data into the data of Arduino platform.     resistance=(float)(4095-val)*10000/val; #get the resistance of the sensor;     print("res=", resistance)         temperature = round((float)(1 / (math.log(resistance / 10000) / bValue + 1 / 298.15) - 273.15), 2)     print("temperature=", temperature);         oled.fill(0)     oled.text("ESP32 XIAO Sensor", 0, 4)     oled.text('resistance:{:.2f}'.format(resistance), 0, 24)     oled.text('temperature:{:.2f}'.format(temperature), 0, 32)     oled.show()     time.sleep_ms(2000) ``` #调试 [localvideo]d93b159133057a5e03e38946e15db4cc[/localvideo]

  • 发表了主题帖: 【得捷电子Follow me第3期】任务4:连接WiFi网络|同步网络时间

    本帖最后由 alanlan86 于 2023-11-19 08:25 编辑 #准备工作 - 搭建好Thonny IDE开发环境,刷好Micropython固件 - 准备ESP32-C3 XIAO开发板一块 ![](https://files.seeedstudio.com/wiki/XIAO_WiFi/front-label-3.png) - SSD1306 OLED屏幕一块,通过扩展口将I2C(SCL=7,SDA=6)链接起来 ![](https://files.seeedstudio.com/wiki/Grove-OLED-Display-0.96-SSD1315-/img/Grove-OLED-Displey-0.96-SSD1315-wiki.jpg) #软件 - 调用network的库进行wifi的扫描和网络链接 - 调用urequests对world time接口返回的json进行解析,获取得到日期和时间 - 关于world time API的介绍可以参看:[世界时间API](http://worldtimeapi.org/pages/examples "世界时间API") - 调用OLED显示过程信息 - 调用5秒之后再次请求时间,并刷新OLED界面显示 ```python from machine import Pin, SoftI2C import ssd1306 from time import sleep import time import network import urequests import ujson # ESP32 Pin assignment i2c = SoftI2C(scl=Pin(7), sda=Pin(6))  # Adjust the Pin numbers based on your connections oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) oled.fill(0) oled.text("Starting up...", 0, 0)#板子启动 oled.show() station = network.WLAN(network.STA_IF) station.active(True) # Network settings wifi_ssid = "SSID-XXXX"#替换为你的SSID wifi_password = "PASSWORD-XXXXX"#替换为你的WIFI密码 url = "http://worldtimeapi.org/api/timezone/Asia/Shanghai" print("Scanning for WiFi networks, please wait...") authmodes = ['Open', 'WEP', 'WPA-PSK' 'WPA2-PSK4', 'WPA/WPA2-PSK'] for (ssid, bssid, channel, RSSI, authmode, hidden) in station.scan():     print("* {:s}".format(ssid))     print("   - Channel: {}".format(channel))     print("   - RSSI: {}".format(RSSI))     print("   - BSSID: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format(*bssid))     print() # Continually try to connect to WiFi access point while not station.isconnected():     # Try to connect to WiFi access point     print("Connecting...")     station.connect(wifi_ssid, wifi_password)     time.sleep(10) # Display connection details print("Connected!") print("My IP Address:", station.ifconfig()[0]) retry=0 while True:     # Perform HTTP GET request on a non-SSL web     response = urequests.get(url)     # Check if the request was successful     if response.status_code == 200:         # Parse the JSON response         data = ujson.loads(response.text)         # Extract the "datetime" field for Shanghai         ny_datetime = data["datetime"]         # Split the date and time components         date_part, time_part = ny_datetime.split("T")         # Get only the first two decimal places of the time         time_part = time_part[:8]         # Get the timezone         timezone = data["timezone"]                  # Clear the OLED display         oled.fill(0)                  # Display the Shanghai date and time on separate lines         oled.text("Shanghai Date:", 0, 0)         oled.text(date_part, 0, 10)         oled.text("Shanghai Time:", 0, 20)         oled.text(time_part, 0, 30)         oled.text("Timezone:", 0, 40)         oled.text(timezone, 0, 50)         # Update the display         oled.show()         retry = 0     else:         retry = retry+1         if(retry > 3):             retry = 0             oled.text("Failed to get the time for Shanghai!")             # Update the display             oled.show()         time.sleep_ms(5000) ``` #调试 [localvideo]f235bc4338e5c41ee529aebf66939b3b[/localvideo]

  • 2023-11-18
  • 发表了主题帖: 【得捷电子Follow me第3期】任务2:驱动扩展板上的OLED屏幕|字符&中文

    本帖最后由 alanlan86 于 2023-11-18 21:56 编辑 #准备硬件 - ESP32-C3 XIAO开发板一块,扩展板一块 ![](https://files.seeedstudio.com/wiki/XIAO_WiFi/pin_map-2.png) #硬件 - SSD1306 OLED屏是一款非常流行通用的屏幕 ![](https://files.seeedstudio.com/wiki/Grove-OLED-Display-0.96-SSD1315-/img/Grove-OLED-Displey-0.96-SSD1315-wiki.jpg) #代码 - SSD1306的库提供了OLED显示所需要的所有接口,调用text显示接口就可以现在英文字符。针对中文显示,采用了字模转换然后将点阵显示。 ```python import time import machine from machine import Pin, SoftI2C import ssd1306 import math import framebuf fonts= { 0xe68891:     [     0x04,0x0E,0x78,0x08,0x08,0xFF,0x08,0x08,0x0A,0x0C,0x18,0x68,0x08,0x08,0x2B,0x10,     0x40,0x50,0x48,0x48,0x40,0xFE,0x40,0x44,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02,     ],#我 0xe788b1:     [     0x00,0x01,0x7E,0x22,0x11,0x7F,0x42,0x82,0x7F,0x04,0x07,0x0A,0x11,0x20,0x43,0x1C,     0x08,0xFC,0x10,0x10,0x20,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x10,0x20,0xC0,0x30,0x0E,     ],#爱 0xe4bda0:     [     0x08,0x08,0x08,0x11,0x11,0x32,0x34,0x50,0x91,0x11,0x12,0x12,0x14,0x10,0x10,0x10,     0x80,0x80,0x80,0xFE,0x02,0x04,0x20,0x20,0x28,0x24,0x24,0x22,0x22,0x20,0xA0,0x40,     ],#你 0xe7a596:     [     0x20,0x11,0x11,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x11,0x17,0x10,     0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00     ],#祖 0xe59bbd:     [     0x00,0x7F,0x40,0x40,0x5F,0x41,0x41,0x4F,0x41,0x41,0x41,0x5F,0x40,0x40,0x7F,0x40,     0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x04,0x44,0x24,0xF4,0x04,0x04,0xFC,0x04     ],#国 } # ESP32-C3 Pin assignment i2c = SoftI2C(scl=Pin(7), sda=Pin(6))  # Adjust the Pin numbers based on your connections oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) def dispay_chinese(ch_str, x_axis, y_axis):    offset_ = 0    y_axis = y_axis*8  # 中文高度一行占8个      x_axis = (x_axis*16)  # 中文宽度占16个    for k in ch_str:        code = 0x00  # 将中文转成16进制编码        data_code = k.encode("utf-8")        code |= data_code[0]

  • 发表了主题帖: 【得捷电子FollowMe第3期】任务3:控制蜂鸣器播放音乐|刷动画

    本帖最后由 alanlan86 于 2023-11-18 20:41 编辑 #准备工作 - ESP32-C3 XIAO以及扩展板一块 ![](https://files.seeedstudio.com/wiki/XIAO_WiFi/board-pic.png) - “事故”/故事:由于我的板载芯片ETA6003坏了:Onion-3:,维修时刻热风枪还把SSD1306的OLED搞废了,所以只能采用Follow Me 1期的外扩OLED SSD1306小板 - 将XIAO的micropython固件刷新搭建好之后,使用Thonny IDE就可以开整了。 - 参考例程代码:[ESP32-C3 XIAO Micropython入门](https://wiki.seeedstudio.com/XIAO_ESP32C3_MicroPython/ "ESP32-C3 XIAO Micropython入门") #硬件 ##蜂鸣器奏音乐 - 蜂鸣器是有源的,所以给它通电即可发出声音。采用PWM对蜂鸣器进行驱动,不同的频率及节律则组成演奏的音乐。 ##OLED刷动画 - SSD1306 OLED屏幕采用的I2C进行驱动的,SCL=7,SDA=6,提供电源GND和VCC即可。 - SSD1306的驱动库则比较容易获得。 #软件 - 软件功能上,整合了OLED刷动画以及蜂鸣器奏乐。 ```python import time import machine from machine import Pin, SoftI2C import ssd1306 import math # Buzzer settings buzzer_pin = machine.Pin(5, machine.Pin.OUT) buzzer = machine.PWM(buzzer_pin) buzzer.freq(1047) # Defining frequency of each music note NOTE_C4 = 262 NOTE_D4 = 294 NOTE_E4 = 330 NOTE_F4 = 349 NOTE_G4 = 392 NOTE_A4 = 440 NOTE_B4 = 494 NOTE_C5 = 523 NOTE_D5 = 587 NOTE_E5 = 659 NOTE_F5 = 698 NOTE_G5 = 784 NOTE_A5 = 880 NOTE_B5 = 988 # Music notes of the song, 0 is a rest/pulse notes = [     NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0,     NOTE_A4, NOTE_G4, NOTE_A4, 0,     NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0,     NOTE_A4, NOTE_G4, NOTE_A4, 0,     NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,     NOTE_A4, NOTE_C5, NOTE_D5, NOTE_D5, 0,     NOTE_D5, NOTE_E5, NOTE_F5, NOTE_F5, 0,     NOTE_E5, NOTE_D5, NOTE_E5, NOTE_A4, 0,     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_D5, NOTE_E5, NOTE_A4, 0,     NOTE_A4, NOTE_C5, NOTE_B4, NOTE_B4, 0,     NOTE_C5, NOTE_A4, NOTE_B4, 0,     NOTE_A4, NOTE_A4,     #Repeat of first part     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0,     NOTE_A4, NOTE_G4, NOTE_A4, 0,     NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0,     NOTE_A4, NOTE_G4, NOTE_A4, 0,     NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,     NOTE_A4, NOTE_C5, NOTE_D5, NOTE_D5, 0,     NOTE_D5, NOTE_E5, NOTE_F5, NOTE_F5, 0,     NOTE_E5, NOTE_D5, NOTE_E5, NOTE_A4, 0,     NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,     NOTE_D5, NOTE_E5, NOTE_A4, 0,     NOTE_A4, NOTE_C5, NOTE_B4, NOTE_B4, 0,     NOTE_C5, NOTE_A4, NOTE_B4, 0,     #End of Repeat     NOTE_E5, 0, 0, NOTE_F5, 0, 0,     NOTE_E5, NOTE_E5, 0, NOTE_G5, 0, NOTE_E5, NOTE_D5, 0, 0,     NOTE_D5, 0, 0, NOTE_C5, 0, 0,     NOTE_B4, NOTE_C5, 0, NOTE_B4, 0, NOTE_A4,     NOTE_E5, 0, 0, NOTE_F5, 0, 0,     NOTE_E5, NOTE_E5, 0, NOTE_G5, 0, NOTE_E5, NOTE_D5, 0, 0,     NOTE_D5, 0, 0, NOTE_C5, 0, 0,     NOTE_B4, NOTE_C5, 0, NOTE_B4, 0, NOTE_A4 ] # Durations (in ms) of each music note of the song # Quarter Note is 250 ms when songSpeed = 1.0 durations = [     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 375, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 375, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 125, 250, 125,     125, 125, 250, 125, 125,     250, 125, 250, 125,     125, 125, 250, 125, 125,     125, 125, 375, 375,     250, 125,     #Rpeat of First Part     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 375, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 375, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 250, 125, 125,     125, 125, 125, 250, 125,     125, 125, 250, 125, 125,     250, 125, 250, 125,     125, 125, 250, 125, 125,     125, 125, 375, 375,     #End of Repeat     250, 125, 375, 250, 125, 375,     125, 125, 125, 125, 125, 125, 125, 125, 375,     250, 125, 375, 250, 125, 375,     125, 125, 125, 125, 125, 500,     250, 125, 375, 250, 125, 375,     125, 125, 125, 125, 125, 125, 125, 125, 375,     250, 125, 375, 250, 125, 375,     125, 125, 125, 125, 125, 500 ]          # ESP32-C3 Pin assignment i2c = SoftI2C(scl=Pin(7), sda=Pin(6))  # Adjust the Pin numbers based on your connections oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) center_x = oled_width // 2 center_y = oled_height // 2 square_size = 6  # Size of each square num_squares = 12  # Number of squares angle_increment = 2 * math.pi / num_squares total_notes = len(notes) num = 0 while True:     #play song     for i in range(total_notes):         current_note = notes         wait = durations         if current_note != 0:             buzzer.duty(512)  # Set duty cycle for sound             buzzer.freq(current_note)  # Set frequency of the note         else:             buzzer.duty(0)  # Turn off the sound         time.sleep_ms(wait)         buzzer.duty(0)  # Turn off the sound                  oled.fill(0)  # Clear the screen         num = num + 1         if (num > num_squares):             num = 0         angle = num * angle_increment         x = int(center_x + (center_x - square_size-30) * math.cos(angle))         y = int(center_y + (center_x - square_size-30) * math.sin(angle))                  # Draw all squares         for j in range(num_squares):             angle_j = j * angle_increment             x_j = int(center_x + (center_x - square_size-30) * math.cos(angle_j))             y_j = int(center_y + (center_x - square_size-30) * math.sin(angle_j))                          oled.fill_rect(x_j, y_j, square_size, square_size, 1)  # Draw the square                      oled.fill_rect(x, y, square_size, square_size, 0)  # Erase the current square             oled.show()         #time.sleep_ms(100)  # Pause before next iteration ``` #调试 [localvideo]1d4d2a28d5d852fa4ef7ab872475abfb[/localvideo]

  • 发表了主题帖: 【得捷电子Follow me第3期】是否有类似问题,管理包安装error?

    搭建好Thonny IDE环境,将microPython固件烧录到ESP32-C3后,尝试安装“SSD1306”包,出现如下错误:   是否有其他老铁也遇到类似问题?求解! PS:尝试过,reset或boot按住再reset,然后再安装,仍然失败~~~  

  • 2023-11-16
  • 发表了主题帖: 【得捷电子Follow me第3期】任务1:使用MicroPython系统|开箱帖

    开箱帖 出差回来到办公室,看到桌面上大包“豪礼”——得捷电子Follow Me第三期的ESP32-C3 XIAO到咯!下面上照片~~~  实物照片:小巧,强大!做小应用非常Nice!另外还带了FPC的天线。 相关资料下载链接:Getting Started | Seeed Studio Wiki   为了便于调试,将扩展底板配上: Seeed Studio的这款扩展底板,外设相当丰富:带RTC 、OLED显示、各种外接接口。 相关资料可以从链接下载:Expansion Board Base for XIAO | Seeed Studio Wiki   为了进一步做一些扩展应用,选中了小圆屏扩展板: 相关资料链接:Getting Started | Seeed Studio Wiki 搭建Micropython开发环境   一、调试准备 (1)、先从上面wiki的链接,将开发板对应的原理图和相关硬件资料下载好。 (2)、准备micropython的固件文件,可以从链接下载:ESP32-C3的microptyhon 固件bin文件。 MicroPython - Python for microcontrollers   二、烧录固件 烧录固件的方式,可选择性还是比较多的,我本着不额外安装多余软件的原则,本来考虑用Follow me之前用过的MUEditor尝试想刷ESP32-C3 XIAO,结果这个集成环境上并不支持。 最后,选择了之前一期提到的有“立场问题”的Thonny IDE——纯技术学习,无政治立场讨论~~~~ (1)Windows环境下,将Thonny IDE按照默认步骤安装运行即可。我选择的是免安装版本——【thonny-4.1.3-windows-portable.zip】解压即可运行。 PS:友情提示,本人开始用的follow me 1期下载的老版本的thonny,并不支持ESP32-C3的micropython固件下载~~~~因此,有同样情况的,记得更新一些IDE即可。 (2)将ESP32-C3 XIAO的开发板,通过USB转Type-C的线缆,链接到电脑上。 (3)运行Tohonny exe,在【运行】->【解析器页面】->选择Micropython (ESP32),然后在端口选择ESP32-C3 XIAO在电脑上虚拟出来的COM口。如下所示:     (4)选择安装或更新microPython (esptool)   (5)剩下的事情,就是交给时间了~~~~慢慢等待,【Done】的出现!!! (6)最后,在Shell串口出现如下的信息,就证明micropython的固件刷好,就可以开始愉快地玩耍了~~~~ 三、调试运行 【蜂鸣器发声】 在Thonny IDE上编辑boot.py文件,保存文件,并点击运行,确认运行环境已搭建成功! import time from time import sleep import machine from machine import Pin, SoftI2C # Buzzer settings buzzer_pin = machine.Pin(5, machine.Pin.OUT) buzzer = machine.PWM(buzzer_pin) buzzer.freq(1047) # Buzzer working while True: buzzer.duty(10) time.sleep(1) buzzer.duty(0) time.sleep(1)   另外,一个方法,也可以通过调用“print”,打印字符,以便确认环境工作正常。   至此,就完成了环境搭建,接下来可以玩耍更多的外设和功能应用拉~~~~~~

  • 2023-11-14
  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】 做好了屏幕扩展板

    这屏是点阵屏,SPI推就行了~~~有幸,5年前玩过sharp全系列的MEMLCD。。。优点:很省电!适合户外!缺点:像素低,贵!应用:码表(不过现在高端的都转彩色半反半透,彩色)

  • 2023-11-02
  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】wifi语音识别灯控之Arduino33IoT功能检查

    我也是Arduino Nano RP2040 Connect!考虑玩玩Tiny ML用EdgeImpulse!有问题,可以多分享交流啦~~~

  • 2023-10-31
  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】智能厨房安全报警器|拆箱帖

    今天试玩arduino,结果刷完后,重新点击BOOTSEL,再接入。。。无法进入boot模式,不出U盘。。。慌死了,以为USB挂了。。。查了一下资料,可以先将Flash hold住(REC脚短接GND),让代码停止,再双击bootsel,成功重新进入Boot模式。   详细参考: Nano RP2040 Connect Cheat Sheet | Arduino Documentation  

  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】智能厨房安全报警器|拆箱帖

    wangerxian 发表于 2023-10-31 09:24 这一块板子价格多少?
    244RMB

  • 2023-10-30
  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】智能厨房安全报警器|拆箱帖

    wangerxian 发表于 2023-10-30 16:08 你这个开发板的外围器件倒是不少呀,麦克风,六轴,WIFI。
    是的,看中就是能够把RP2040,配搭了一些Sensor,这样后续可玩性还不错!

  • 发表了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】智能厨房安全报警器|拆箱帖

    本帖最后由 alanlan86 于 2023-10-30 08:37 编辑 出差回来,看到办公桌上的大包快递,迫不及待地立马拆箱,看看从Digikey发过来的板子   核心主控“大头”——Ardunio Nano RP2040 Connect Ardunio Nano RP2040 Connect 占掉了“物料经费”的一半,当然选择它,还是有理由的: 1)外型紧凑、性能可靠的Nano板支持BLE和WiFi连接,非常适合物联网应用。这也意味着您可以利用云计算的力量,完全兼容Arduino Cloud。 2)麦克风和运动感应进一步丰富了应用的可能性。内置麦克风可用于语音激活、音频控制、甚至是人工智能语音识别。六轴智能IMU具有人工智能功能(向板件提示移动的方向),并添加了跌倒感应和双击激活功能。 3)当然,就是之前Follow me活动中对于Pico/Pico W的使用,使得对于Raspberry RP2040的熟悉,这样使用起来会简单很多。   快递包装: (1)大集合照 (2)小巧而强大的主控   (3)气体传感器 这个比较关键的器件,我选择购买了3个模块,有MQ2,MQ6,LPG,考虑不同的传感器对于煤气/液化气/可挥发气体的表现不一样。 关于传感器选型,小科普一下: MQ-2 :囊括常见可燃气体。MQ-3B:酒精。MQ-4 :天然气/甲烷。MQ-5B:液化石油气、天然气、人工煤气。MQ-6 :液化石油气、丙烷。MQ-7B:一氧化碳。MQ-8 :氢气。MQ-9B:一氧化碳及其它可燃气体。MQ303B:酒精。MQ131:臭氧。MQ135:空气质量检测(氨气、苯、酒精、烟雾颗粒)。MQ136:硫化氢。MQ137:氨气。MQ138:挥发性有机物(芳醇、苯、乙醛、酮类、醚类)。   常见的9款气体传感器包含: MQ-2——烟雾气敏传感器 MQ-3——酒精传感器 MQ-4——甲烷传感器 MQ-5——液化气天然气城市煤气传感器 MQ-6——异丁烷丙烷传感器 MQ-7——一氧化碳传感器模块 MQ-8——氢气传感器 MQ-9——一氧化碳可燃气体传感器 MQ-135——空气质量检测传感器 (4)其他模块:继电器模块/喇叭 考虑到关煤气阀门(执行机构)选了继电器模块,作为开关执行机构。另外,之前follow me活动,有一个I2S的语音播放模块,此次再次添置一个3W的喇叭,即可以做语音告警或声音播放了。 接下来,就得上手好好设计,对于传感器的特性和功能进行挖掘挖掘。期待接下来的分享吧!!!  

  • 2023-10-20
  • 回复了主题帖: 【DigiKey“智造万物,快乐不停”创意大赛】中考倒计时摆件 1. 开箱

    CORES3 带屏带壳,很Nice!--“希望做出来的东西孩子能喜欢,和孩子一起加油!”

最近访客

< 1/4 >

统计信息

已有48人来访过

  • 芯积分:273
  • 好友:--
  • 主题:40
  • 回复:40
  • 课时:3
  • 资源:1

留言

你需要登录后才可以留言 登录 | 注册


现在还没有留言