This commit is contained in:
Forairaaaaa
2023-02-14 10:20:19 +08:00
parent 9a8f35eafe
commit 5f76d4471d
7 changed files with 14 additions and 14 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
# M5Stack Core2 for AWS IoT EduKit MicroPython Examples
# M5Stack Core2 for AWS IoT Kit MicroPython Examples
_NOTE:_ This repo is limited in functionality, and is a result of customer requests to have an AWS IoT referenceable example utilizing the ATECC608 in MicroPython. For more complete set of MicroPython functionality, we recommend using M5Stack's UIFlow tool. Community contributions are welcome.
## Cloning
@@ -27,7 +27,7 @@ git submodule update --init --recursive
```
## General Setup and Usage
To use this repository on the [M5Stack Core2 for AWS IoT EduKit](https://m5stack.com/products/m5stack-core2-esp32-iot-development-kit-for-aws-iot-edukit), you must have the [ESP-IDF release v4.2](https://github.com/espressif/esp-idf/tree/release/v4.2) installed first. You can find the installation instructions on [Espressif's Documentation](https://docs.espressif.com/projects/esp-idf/en/release-v4.2/esp32/get-started/index.html#installation-step-by-step). With the ESP-IDF tools added to your path, you can follow the steps below to run the various examples provided in this repository.
To use this repository on the [M5Stack Core2 for AWS IoT Kit](https://m5stack.com/products/m5stack-core2-esp32-iot-development-kit-for-aws-iot-edukit), you must have the [ESP-IDF release v4.2](https://github.com/espressif/esp-idf/tree/release/v4.2) installed first. You can find the installation instructions on [Espressif's Documentation](https://docs.espressif.com/projects/esp-idf/en/release-v4.2/esp32/get-started/index.html#installation-step-by-step). With the ESP-IDF tools added to your path, you can follow the steps below to run the various examples provided in this repository.
## Compiling the MicroPython cross-compiler, mpy-cross
@@ -90,7 +90,7 @@ execfile("examples/<<FILENAME>>.py")
## Running the AWS IoT Connectivity Example
### Prerequisites
In order to run the example, you will need to first have the device registered to your AWS account with the required policy attached to the thing, and your AWS IoT mqtt host endpoint address. It's recommended you complete the following AWS IoT EduKit tutorials first so you have everything setup:
In order to run the example, you will need to first have the device registered to your AWS account with the required policy attached to the thing, and your AWS IoT mqtt host endpoint address. It's recommended you complete the following AWS IoT Kit tutorials first so you have everything setup:
1) [Getting Started](https://edukit.workshop.aws/en/getting-started.html)
2) [Cloud Connected Blinky](https://edukit.workshop.aws/en/blinky-hello-world.html)
@@ -128,7 +128,7 @@ execfile("examples/AWS_IoT_connect.py")
## Clean up
To save power, bandwidth, and avoid unexpected AWS charges, it is always good to shut off usage of resources. You can either hold the power button for 6-seconds to shut off the device, or erase the flash memory.
_NOTE:_ Erasing the flash memory will cause the device to make a "ticking" sound as it constantly restarts itself due to not having an application to run. To avoid this, it is recommended you upload the [factory firmware](https://github.com/m5stack/Core2-for-AWS-IoT-EduKit/tree/master/Factory-Firmware).
_NOTE:_ Erasing the flash memory will cause the device to make a "ticking" sound as it constantly restarts itself due to not having an application to run. To avoid this, it is recommended you upload the [factory firmware](https://github.com/m5stack/Core2-for-AWS-IoT-Kit/tree/master/Factory-Firmware).
To erase the flash memory, you can use the configured make operation "erase":
@@ -1,8 +1,8 @@
# AWS IoT connectivity example in MicroPython for the M5Stack Core2 for AWS IoT EduKit
# AWS IoT connectivity example in MicroPython for the M5Stack Core2 for AWS IoT Kit
# This example uses the ESP32 to connect to AWS IoT Core using the attached ATECC608
# Trust&GO secure element for establishing a secure TLS connection.
#
# Prerequisite — This example assumes you have completed the AWS IoT EduKit tutorials
# Prerequisite — This example assumes you have completed the AWS IoT Kit tutorials
# 1) Getting Started
# 2) Cloud Connected Blinky / Hello World
#
@@ -54,7 +54,7 @@ def sub_cb(topic, msg):
def aws_iot_publish():
pub_topic = client_id + "/"
print("Publishing to topic", pub_topic)
mqtt_client.publish(pub_topic, json.dumps({"message": "Hello World", "device_type": "Core2 for AWS IoT Edukit"}), qos=0)
mqtt_client.publish(pub_topic, json.dumps({"message": "Hello World", "device_type": "Core2 for AWS IoT Kit"}), qos=0)
def aws_iot_subscribe():
sub_topic = client_id + "/#"
@@ -1,6 +1,6 @@
from machine import Pin
from M5Library import I2S
from Edukit import lcd
from Kit import lcd
import struct
import time
@@ -1,4 +1,4 @@
from Edukit import lcd
from Kit import lcd
import time
lcd.fillScreen(lcd.BLACK)
@@ -7,7 +7,7 @@ for datum in range(9):
lcd.fillScreen(lcd.BLACK)
lcd.font(lcd.FONT_DejaVu26)
lcd.text(160, 120, "AWS IoT EduKit", lcd.WHITE, bgcolor=lcd.WHITE, textdatum=datum)
lcd.text(160, 120, "AWS IoT Kit", lcd.WHITE, bgcolor=lcd.WHITE, textdatum=datum)
lcd.drawCircle(160, 120, 5, lcd.GREEN)
lcd.drawPixel(160, 120, lcd.GREEN)
@@ -15,7 +15,7 @@ for datum in range(9):
lcd.font(lcd.FONT_DejaVu26)
lcd.setColor(lcd.BLUE, lcd.BLACK)
lcd.text(160, 120, "Core2 for AWS IoT EduKit", textdatum=lcd.DATUM_MC)
lcd.text(160, 120, "Core2 for AWS IoT Kit", textdatum=lcd.DATUM_MC)
lcd.font(lcd.FONT_DejaVu14)
lcd.drawCircle(160, 120, 5, lcd.GREEN)
@@ -24,7 +24,7 @@ lcd.drawPixel(160, 120, lcd.GREEN)
lcd.setCursor(0, 0)
for i in range(6):
lcd.font(i)
lcd.print('EduKit')
lcd.print('Kit')
time.sleep(0.2)
lcd.font(lcd.FONT_DejaVu14)
@@ -1,4 +1,4 @@
from Edukit import btn_left, touch
from Kit import btn_left, touch
import time
while True:
@@ -1,6 +1,6 @@
from M5Library import I2S
from machine import Pin
from Edukit import pmu
from Kit import pmu
import io
BCK_PIN = Pin(12)