Skip to content

Added support for OrangePi Zero 3 in oled_ssd1306.py #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions examples/orangepi-sensors/oled_ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
import time
import wiringpi
from wiringpi import GPIO
import argparse

parser = argparse.ArgumentParser(description='i2c')
parser.add_argument("--device", type=str, default="/dev/i2c-0", help='specify the i2c node')
args = parser.parse_args()
I2C_ADDR = 0x3c
fd = 0

print(f"Opening device '{args.device}' at address I2C_ADDR = '{hex(I2C_ADDR)}'")

yi = [' ',' ',' ',' ']
zi = [
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#//0
Expand Down Expand Up @@ -272,7 +278,7 @@ def full_string(s):
def main():
#init
wiringpi.wiringPiSetup()
fd = wiringpi.wiringPiI2CSetup(I2C_ADDR)
fd = wiringpi.wiringPiI2CSetupInterface(args.device,I2C_ADDR)
if not fd:
return False;
wiringpi.wiringPiI2CWriteReg8(fd, 0x00, 0xa1)
Expand Down