iot:micropython
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
iot:micropython [2019/10/14 02:35] – angelegt admin | iot:micropython [2025/02/11 10:05] (aktuell) – [Asynchronous Programming mit uasyncio:] admin | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== MicroPython ====== | ====== MicroPython ====== | ||
- | === MicroPython für esp8266 | + | [[iot: |
+ | |||
+ | ==== MicroPython für ESP8266 | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | |||
+ | |||
+ | * [[https:// | ||
+ | |||
+ | ==== Develop for / with Micropython ==== | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// | ||
+ | |||
+ | ==== Porting Micropython ==== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | ==== Blink LED: ==== | ||
+ | |||
+ | <code python> | ||
+ | from machine import Pin | ||
+ | from time import sleep | ||
+ | |||
+ | led = Pin(2, Pin.OUT) # sets PIN 2 as Output (most boards have an LED connected) | ||
+ | |||
+ | while True: | ||
+ | led.value(not led.value()) | ||
+ | sleep(0.25) | ||
+ | </ | ||
+ | |||
+ | ==== LED Helligkeit per PWM regeln: ==== | ||
+ | |||
+ | <code python> | ||
+ | from machine import Pin, PWM | ||
+ | from time import sleep | ||
+ | |||
+ | frequency = 5000 # Hz: can be a value between 0 and 78125 | ||
+ | led = PWM(Pin(2), frequency) | ||
+ | |||
+ | while True: | ||
+ | for duty_cycle in range(0, 1024): #can be a value between 0 and 1023 (100%) | ||
+ | led.duty(duty_cycle) | ||
+ | sleep(0.005) | ||
+ | </ | ||
+ | |||
+ | Quelle: https:// | ||
+ | |||
+ | ==== Ping auf dem ESP32 ==== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | ==== Asynchronous Programming mit uasyncio: ==== | ||
- | === MQTT === | + | * https:// |
+ | * https:// | ||
+ | ==== MQTT auf dem ESP32: ==== | ||
* https:// | * https:// | ||
+ | * https:// | ||
<code python> | <code python> | ||
Zeile 25: | Zeile 78: | ||
</ | </ | ||
+ | ==== I2S Audio auf dem ESP32: ==== | ||
- | === DHT11/22 (ESP32)=== | + | * https:// |
+ | * https:// | ||
+ | |||
+ | ==== BME280==== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | ==== DHT11/22 (ESP32)==== | ||
* https:// | * https:// | ||
<code python> | <code python> | ||
Zeile 46: | Zeile 107: | ||
print(msg) | print(msg) | ||
| | ||
- | | + | |
- | sleep 2 | + | sleep(2) |
</ | </ | ||
- | === Enthaltene Module (ESP32)=== | + | |
+ | ==== MicroPython to AWS-IOT ==== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | ==== Enthaltene Module (ESP32)==== | ||
<code python> | <code python> | ||
help(' | help(' | ||
Zeile 74: | Zeile 140: | ||
</ | </ | ||
+ | ==== Freien Speicher ermitteln ==== | ||
+ | <code python> | ||
+ | >>> | ||
+ | >>> | ||
+ | >>> | ||
+ | 107488 | ||
+ | >>> | ||
+ | >>> | ||
+ | </ |
iot/micropython.1571020532.txt.gz · Zuletzt geändert: 2019/10/14 02:35 von admin