三木社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 369|回复: 0
打印 上一主题 下一主题

onewire总线

[复制链接]

1657

主题

1684

帖子

5684

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
5684
跳转到指定楼层
楼主
发表于 2017-7-12 08:26:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. from machine import Pin
  2. import onewire
  3. ow = onewire.OneWire(Pin(12)) # create a OneWire bus on GPIO12
  4. ow.scan()               # return a list of devices on the bus
  5. ow.reset()              # reset the bus
  6. ow.readbyte()           # read a byte
  7. ow.read(5)              # read 5 bytes
  8. ow.writebyte(0x12)      # write a byte on the bus
  9. ow.write('123')         # write bytes on the bus
  10. ow.select_rom(b'12345678') # select a specific device by its ROM code
复制代码


回复

使用道具 举报

Archiver|手机版|小黑屋|三木电子社区 ( 辽ICP备11000133号-4 )

辽公网安备 21021702000620号

GMT+8, 2026-3-6 00:08 , Processed in 0.027345 second(s), 22 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表