Who am I?

I am a graduated student from school, but I will go back to college soon.
I want to do more for the IT frontier and practical engineering field, and I am a  passionate guy of computer science and technology. In the meantime, I like the mathematics, including set theory and logic, probability and statistic, matirx and abstract space, etc. you know, theory is from the practical engineering, and beyond it. So I have to survive in the seam between academic and engineering field.

转载于:https://www.cnblogs.com/gxhrid/archive/2009/04/24/1442841.html

### 查询SSD1306显示屏的WHO_AM_I寄存器信息 对于SSD1306显示器而言,并不存在名为`WHO_AM_I`的标准寄存器。通常情况下,在许多传感器或特定类型的IC中,存在一个叫做`WHO_AM_I`的寄存器用于识别芯片型号或者制造商身份。然而,针对SSD1306 OLED显示驱动器来说,其通信协议并没有规定这样一个专门用来确认设备ID的寄存器。 相反,SSD1306通过I2C接口进行通讯时依赖于预设的硬件地址来区分不同的外设。一般地,该器件支持两个可能的7位I2C地址:0x3C和0x3D(取决于连接至SDA线路上的选择引脚状态)。为了验证所连接的是不是一块有效的SSD1306屏幕,可以尝试向这些默认地址发送命令并观察响应情况作为间接手段来进行初步判断[^1]。 如果确实需要获取有关已安装模块的具体版本或其他特性参数,则建议查阅具体产品文档或联系供应商以获得更详细的资料说明。 ```python import smbus def check_ssd1306_presence(address=0x3C): bus = smbus.SMBus(1) # 使用 I2C 总线编号 1 (Raspberry Pi 上通常是这个) try: # 尝试写入一条指令给定地址处的设备 bus.write_byte_data(address, 0x00, 0x00) return True except IOError: return False if __name__ == "__main__": addresses_to_check = [0x3C, 0x3D] for addr in addresses_to_check: if check_ssd1306_presence(addr): print(f"Found SSD1306 at address {hex(addr)}") else: print(f"No device found at address {hex(addr)}") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值