4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi PicoでCO2濃度を測定する

Last updated at Posted at 2021-02-25
## CO2センサーモジュール [CO2センサーモジュール MH-Z19C](https://akizukidenshi.com/catalog/g/gM-16142/)を秋月で買いました。

接続図

CO2A.jpg

ソースコード

import machine
import utime

mhz19c=machine.UART(1,baudrate=9600)

while True:
    data=bytearray([0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79])
    mhz19c.write(data)
    mhz19c.readinto(data,len(data))
    co2=data[2]*256+data[3]
    print(str(co2)+' ppm')
    utime.sleep(1)

参考

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?