Skip to content
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

Example snippet not working #10

Closed
arnauddevie opened this issue Apr 10, 2021 · 2 comments
Closed

Example snippet not working #10

arnauddevie opened this issue Apr 10, 2021 · 2 comments

Comments

@arnauddevie
Copy link

In the example labeled "Get temperature when there is only one 1-wire device on the bus", there is a typo and TemperatureSensor() call does not match the signature for this class and therefore fails.

Example

from digitemp.master import UART_Adapter
from digitemp.device import TemperatureSensor

sensor = TemperatureSensor(UART_Adapter('/dev/ttyS0') # <- missing ')'
sensor.info()
print(sensor.get_temperature())

Signature

def TemperatureSensor(bus, rom): # rom must be passed

Maybe you were thinking of OneWireTemperatureSensor() ?

Thank you for sharing your library btw!

@mcsakoff
Copy link
Owner

Nice catch!
Actually not only missed a closing bracket, I've also forgot to implement ROM argument as optional. Missed it during last refactoring.

@mcsakoff
Copy link
Owner

Fixed in a8220ad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants