Python Tools

1. 简单的HTTP服务器

  python -m SimpleHTTPServer 8080

  python3 -m http.server 8080

  Python自带的HTTP服务,会将启动目录作为根目录提供HTTP服务,如果不指定端口,则使用默认端口:8000。

  访问:http://ip:prot/

转载于:https://www.cnblogs.com/wanghaiyang1930/p/10519478.html

### Python Tools for Single-Chip Microcomputer Development For single-chip microcomputer (MCU) development using Python, several tools and resources can significantly enhance the process of creating embedded applications. These tools provide a bridge between high-level programming languages like Python and low-level hardware control required by MCUs. #### 1. **MicroPython** MicroPython is an implementation of Python optimized to run on microcontrollers and in constrained environments. It includes a small subset of the CPython standard library but adds modules specifically designed for interacting with hardware peripherals such as GPIO pins, I2C buses, SPI interfaces, etc.[^1] ```python import pyb led = pyb.LED(1) while True: led.toggle() pyb.delay(500) ``` This code snippet demonstrates how easily one can interact with an LED connected to pin 1 on a PyBoard or compatible board running MicroPython. #### 2. **CircuitPython** Developed by Adafruit Industries, CircuitPython builds upon MicroPython while adding more user-friendly features aimed at beginners and educators alike. The syntax remains similar enough that those familiar with either language will find it easy to adapt their skills across platforms.[^2] ```python import time from digitalio import DigitalInOut, Direction led = DigitalInOut(board.D13) led.direction = Direction.OUTPUT while True: led.value = not led.value time.sleep(0.5) ``` Here’s another example showing blinking an onboard red LED every half second when executed within any supported device powered by CircuitPython firmware. #### 3. **Espressif IDF with ESP-IDF-Python API Bindings** The Espressif IoT Development Framework supports both C/C++ and now also offers official support through its `esp-idf` package which allows developers to write native extensions written purely in Python thanks to bindings provided via Cython compilation steps during installation procedures outlined here[^3]. ```bash pip install espidf esptool.py --chip esp32 flash_id idf.py build monitor ``` These commands illustrate setting up your environment along with flashing binaries onto target devices followed by monitoring serial output directly from terminal sessions without needing additional software outside what comes pre-installed alongside this toolkit distribution itself! ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值