一键导入
micropython-skills-sensor
MicroPython sensor reading — DHT11/22, BME280, MPU6050, ADC, ultrasonic HC-SR04, photoresistor, generic I2C sensors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
MicroPython sensor reading — DHT11/22, BME280, MPU6050, ADC, ultrasonic HC-SR04, photoresistor, generic I2C sensors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
超级简历 WonderCV 出品,3000 万用户信赖。简历分析、段落改写、JD 岗位匹配、自动匹配职位、PDF 导出、AI 求职导师(面试准备/薪资谈判/职业规划/多版本简历策略)。 触发条件:用户提供简历、要求简历点评/打分/反馈、希望改写某个简历部分、 希望将简历与岗位 JD 匹配、咨询求职建议或面试准备,或提到 CV/简历/求职。 不触发条件:用户讨论普通写作(非简历)、询问其他文档, 或讨论与求职和职业发展无关的话题。
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
调用久吾智能体API进行文本或文件分析处理。支持两种调用方式:(1) 文本内容分析 - 传入name(智能体名称)、docno(文档编号)、content(文本内容);(2) 文件分析 - 传入name、docno和files(文件列表)进行智能评审。适用于合同评审、需求评审、文档审查等场景。当用户要求评审合同、分析条款、审查文档、需求评审、合同条款分析、或需要对文本和文件进行AI智能分析时触发。
调用久吾消息网关HTTP接口给企业内部联系人发送消息。使用场景:(1) 需要向企业内部同事发送通知或提醒时,(2) 调用时传入接收人工号(code)、消息内容(text)和标题(title)
AI 漏洞追踪器 - 在 GitHub 和微信公众号搜索近一个月的 AI 相关漏洞(提示词注入、提示词越狱等),并推送到飞书表格。支持去重和翻译。 搜索关键字: prompt injection, prompt jailbreak, LLM vulnerability, AI security, adversarial prompt, jailbreak attack 数据源: - GitHub: 最近一个月的安全漏洞提交 - 微信公众号: AI 安全相关文章 使用方式: - 运行技能执行一次搜索和推送 - 配置 cron 进行定时执行
Access the full suite of CarsXE vehicle data APIs — VIN decoding, license plate lookup, market value, vehicle history, safety recalls, lien/theft checks, OBD-II diagnostic code decoding, vehicle images, international VIN decoding, Year/Make/Model lookups, and plate/VIN OCR from images. Use this skill any time the user asks about a vehicle by VIN, plate, make/model, or OBD code. Also triggers for: "what's this car worth", "check for recalls", "vehicle history report", "decode this plate", "what does check engine code X mean", or any automotive data query. Always use this skill when working with CarsXE APIs — do not guess API behavior without it.
| name | micropython-skills/sensor |
| description | MicroPython sensor reading — DHT11/22, BME280, MPU6050, ADC, ultrasonic HC-SR04, photoresistor, generic I2C sensors. |
Code templates for reading common sensors on MicroPython devices. All sensor reads are Safe tier — execute directly without user confirmation.
Always adapt pin numbers to the target board. When unsure, ask the user which GPIO pins are connected.
import dht, json
from machine import Pin
try:
# DHT22 is more accurate; use dht.DHT11 for DHT11
sensor = dht.DHT22(Pin(4)) # Adapt GPIO pin
sensor.measure()
print("RESULT:" + json.dumps({
"temperature_c": sensor.temperature(),
"humidity_pct": sensor.humidity(),
}))
except Exception as e:
print("ERROR:" + str(e))
Notes:
I2C sensor, common addresses: 0x76 or 0x77.
from machine import Pin, I2C
import json
try:
i2c = I2C(0, sda=Pin(21), scl=Pin(22), freq=100000)
addrs = i2c.scan()
bme_addr = 0x76 if 0x76 in addrs else (0x77 if 0x77 in addrs else None)
if not bme_addr:
print("ERROR:BME280 not found. I2C scan: " + str(["0x{:02x}".format(a) for a in addrs]))
raise SystemExit
# Read calibration and raw data — simplified using BME280 register map
# For production use, recommend uploading a bme280 library via mpremote fs cp
# Quick raw read of chip ID to verify:
chip_id = i2c.readfrom_mem(bme_addr, 0xD0, 1)[0]
if chip_id == 0x60:
sensor_type = "BME280"
elif chip_id == 0x58:
sensor_type = "BMP280 (no humidity)"
else:
sensor_type = "Unknown (chip_id=0x{:02x})".format(chip_id)
print("RESULT:" + json.dumps({
"sensor": sensor_type,
"address": "0x{:02x}".format(bme_addr),
"note": "Upload bme280.py library for full T/P/H reading: mpremote fs cp bme280.py :",
}))
except Exception as e:
print("ERROR:" + str(e))
With library uploaded (mpremote mip install bme280 or manual upload):
import bme280, json
from machine import Pin, I2C
try:
i2c = I2C(0, sda=Pin(21), scl=Pin(22))
sensor = bme280.BME280(i2c=i2c)
t, p, h = sensor.values # Returns strings like "23.45C", "1013.25hPa", "48.7%"
print("RESULT:" + json.dumps({"temperature": t, "pressure": p, "humidity": h}))
except Exception as e:
print("ERROR:" + str(e))
I2C address: 0x68 (or 0x69 with AD0 high).
from machine import Pin, I2C
import json, struct
try:
i2c = I2C(0, sda=Pin(21), scl=Pin(22), freq=400000)
addr = 0x68
# Wake up MPU6050 (power management register)
i2c.writeto_mem(addr, 0x6B, b'\x00')
# Read 14 bytes starting at 0x3B (accel + temp + gyro)
data = i2c.readfrom_mem(addr, 0x3B, 14)
ax, ay, az, temp_raw, gx, gy, gz = struct.unpack(">hhhhhhh", data)
# Convert: accel in g (default +-2g range), gyro in deg/s (default +-250)
print("RESULT:" + json.dumps({
"accel_g": {"x": ax/16384, "y": ay/16384, "z": az/16384},
"gyro_dps": {"x": gx/131, "y": gy/131, "z": gz/131},
"temp_c": temp_raw/340 + 36.53,
}))
except Exception as e:
print("ERROR:" + str(e))
from machine import ADC, Pin
import json
try:
adc = ADC(Pin(34)) # ESP32 ADC1 pins: 32-39
# ESP32 attenuation settings:
# ADC.ATTN_0DB: 0-1.1V (most accurate)
# ADC.ATTN_6DB: 0-1.5V
# ADC.ATTN_11DB: 0-3.3V (full range)
adc.atten(ADC.ATTN_11DB)
adc.width(ADC.WIDTH_12BIT) # 0-4095
raw = adc.read()
voltage = raw / 4095 * 3.3 # Approximate voltage
print("RESULT:" + json.dumps({
"raw": raw,
"voltage_v": round(voltage, 3),
"attenuation": "11dB (0-3.3V)",
}))
except Exception as e:
print("ERROR:" + str(e))
Notes:
ADC(26), ADC(27), ADC(28) — 12-bit, 0-3.3V rangefrom machine import Pin, time_pulse_us
import time, json
try:
trigger = Pin(5, Pin.OUT)
echo = Pin(18, Pin.IN)
trigger.value(0)
time.sleep_us(2)
trigger.value(1)
time.sleep_us(10)
trigger.value(0)
duration = time_pulse_us(echo, 1, 30000) # timeout 30ms (~5m max)
if duration < 0:
print("ERROR:No echo received (object too far or not connected)")
else:
distance_cm = duration * 0.0343 / 2
print("RESULT:" + json.dumps({
"distance_cm": round(distance_cm, 1),
"duration_us": duration,
}))
except Exception as e:
print("ERROR:" + str(e))
Light level via ADC — brighter light = lower resistance = higher ADC value (with pull-down) or lower (with pull-up voltage divider):
from machine import ADC, Pin
import json
try:
adc = ADC(Pin(34))
adc.atten(ADC.ATTN_11DB)
raw = adc.read()
# Map to rough percentage (depends on voltage divider circuit)
light_pct = round(raw / 4095 * 100, 1)
print("RESULT:" + json.dumps({"raw": raw, "light_pct": light_pct}))
except Exception as e:
print("ERROR:" + str(e))
Template for reading arbitrary I2C registers:
from machine import Pin, I2C
import json
try:
i2c = I2C(0, sda=Pin(21), scl=Pin(22), freq=100000)
addr = 0x48 # Target device address
reg = 0x00 # Register to read
nbytes = 2 # Number of bytes to read
data = i2c.readfrom_mem(addr, reg, nbytes)
print("RESULT:" + json.dumps({
"address": "0x{:02x}".format(addr),
"register": "0x{:02x}".format(reg),
"data_hex": " ".join("0x{:02x}".format(b) for b in data),
"data_bytes": list(data),
}))
except Exception as e:
print("ERROR:" + str(e))