制造商零件编号 C008-B
ATOM MATRIX ESP32 DEV KIT
M5Stack Technology Co., Ltd.
所订产品一般在 7-10个工作日 内送达中国,具体时间取决于收货地点。
最低订购金额为人民币 300 元,顺丰快递免运费配送。
当用人民币下单时,按照国际贸易条款 DDP(DigiKey 支付关税、海关费用和当地税款)方式结算。
电汇预付
更多来自全授权合作伙伴的产品
下单后,从合作伙伴发货平均需要时间 1-3 天,也可能产生额外运费。可能另外收取运费。 实际发货时间请留意产品详情页、购物车和结账页面上的说明。
国际贸易结算方式:CPT(交货时支付关税、海关费用和适用 VAT/应付税金)
有关详情,请访问帮助和支持
License: General Public License Bluetooth / BLE Wifi Arduino
* Thanks for the source code and project information provided by @Andreas Motzek
Things used in this project
Hardware components
M5Stack ATOM Matrix ESP32 Development Kit×1
Software apps and online services
MicroPython Firmware for ESP32 v1.19.1
Download esp32-20220618-v1.19.1.bin from the download page.
MQTT Client
Use the MQTT client to send messages to your device from a web browser.
For Windows:
1. Install Python, Esptool, and Ampy
If you have no Python 3 installation on your computer, please download the installer from https://www.python.org/downloads/ and execute it. Then install Esptool and Ampy with
> pip3 install esptool
> pip3 install adafruit-ampy
on the command line.
2. Download and Install Firmware
Download https://micropython.org/resources/firmware/esp32-20220618-v1.19.1.bin. Connect your ATOM Matrix to your computer via USB. If you are connecting it the first time wait a little until Windows installs the driver. Open the Windows Device Manager and look into "COM & LPT" to find the correct COM port, e.g., COM6. Then install the firmware with
> esptool.py --chip esp32 --port COM6 erase_flash
> esptool.py --chip esp32 --port COM6 write_flash -z 0x1000 esp32-20220618-v1.19.1.bin
Reset your device after the installation is finished.
3. Download and Install Libraries
Create a folder named lib on your computer. Download the files cooperative_multitasking.mpy, font5.mpy, mqtt.mpy, mqtt_client.mpy and neopixel_scroller.mpy from https://bitbucket.org/amotzek/micro-python/downloads/ into that lib folder. In the command line navigate to the folder above lib and then execute
> ampy.exe --port COM6 --delay 3 put lib
to upload the folder to your ATOM Matrix.
4. Edit and Upload main.py
From the Code section of this project copy the file main.py to your computer and fill in your WLAN credentials in line 21, a username in line 19, and a MQTT topic name in line 49. Execute
> ampy.exe --port COM6 --delay 3 put main.py
to upload the file to your ATOM Matrix.
5. Test
In your browser go to http://www.hivemq.com/demos/websocket-client/. Click the Connect button. Enter the topic name from line 49 into the Topic field. Enter
{ "message": "HELLO!" }
into the Message field. Click the Publish button. Your ATOM Matrix should display HELLO! now.
Only capital letters A to Z, digits and some other characters can be displayed. For a complete list see the source code of Font5 at https://bitbucket.org/amotzek/micro-python/src/master/src/main/modules/font5.py.
Code
谢谢!
敬请关注收件箱中的 DigiKey 新闻与更新!
请输入电子邮件地址
import uos
from cooperative_multitasking import Tasks
from network import WLAN, AP_IF
from mqtt_client import MQTTClient
from machine import Pin
from neopixel import NeoPixel
from font5 import Font5
from neopixel_scroller import NeopixelScroller
tasks = Tasks()
ap = WLAN(AP_IF)
ap.active(False)
ap = None
client = MQTTClient(tasks,
hostname = 'broker.mqttdashboard.com',
client_id = '',
user_name = '...',
password = '')
client.activate_wlan([('...', '...')])
client.start()
gpio27 = Pin(27, Pin.OUT)
neopixels = NeoPixel(gpio27, 25)
font = Font5()
colors = [(20, 0, 0), (20, 20, 0), (0, 20, 0), (0, 0, 20)]
scroller = None
def randint(low, high):
s = 0
bs = uos.urandom(4)
for b in bs:
s = (s << 8) | b
return low + (s % (high - low + 1))
def random_color():
return colors[randint(0, len(colors) - 1)]
def receive_message(topic, payload_object):
global scroller
try:
message = payload_object['message']
color = random_color()
scroller = NeopixelScroller(neopixels, message, font, foreground_color=color)
except:
pass
client.subscribe('...', receive_message)
def has_message():
return scroller is not None
def await_message():
tasks.when_then(has_message, scroll_message)
def is_connected():
return client.is_connected()
def scroll_message():
scroller.scroll()
neopixels.write()
if is_connected():
tasks.after(300, scroll_message)
else:
tasks.now(clear_display)
def clear_display():
global scroller
scroller = None
for pixel_index in range(25):
neopixels[pixel_index] = (0, 0, 0)
neopixels.write()
tasks.now(await_message)
tasks.now(await_message)
while tasks.available():
tasks.run()