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

Litte change in example: AdafruitDHT.py #1

Open
ds2k5 opened this issue Dec 10, 2016 · 0 comments
Open

Litte change in example: AdafruitDHT.py #1

ds2k5 opened this issue Dec 10, 2016 · 0 comments

Comments

@ds2k5
Copy link

ds2k5 commented Dec 10, 2016

Hello,
i tryed your: Python_DHT with Python 3.4.2.
Did not work.

python3 AdafruitDHT.py
File "AdafruitDHT.py", line 35
print 'usage: sudo ./Adafruit_DHT.py [11|22|2302] GPIOpin#'
^
SyntaxError: Missing parentheses in call to 'print'

It work with python2

Here is my mod

AdafruitDHT.zip

24c24
< import Adafruit_DHT
---
> import Python_DHT
28,30c28,30
< sensor_args = { '11': Adafruit_DHT.DHT11,
< 				'22': Adafruit_DHT.DHT22,
< 				'2302': Adafruit_DHT.AM2302 }
---
> sensor_args = { '11': Python_DHT.DHT11,
> 				'22': Python_DHT.DHT22,
> 				'2302': Python_DHT.AM2302 }
35,36c35,36
< 	print 'usage: sudo ./Adafruit_DHT.py [11|22|2302] GPIOpin#'
< 	print 'example: sudo ./Adafruit_DHT.py 2302 4 - Read from an AM2302 connected to GPIO #4'
---
> 	print ("usage: sudo ./Adafruit_DHT.py [11|22|2302] GPIOpin#")
> 	print ("example: sudo ./Adafruit_DHT.py 2302 4 - Read from an AM2302 connected to GPIO #4")
41c41
< humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
---
> humidity, temperature = Python_DHT.read_retry(sensor, pin)
48c48
< 	print 'Temp={0:0.1f}*C  Humidity={1:0.1f}%'.format(temperature, humidity)
---
> 	print ('Temp={0:0.1f}*C  Humidity={1:0.1f}%'.format(temperature, humidity))
50c50
< 	print 'Failed to get reading. Try again!'
---
> 	print ('Failed to get reading. Try again!')

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

1 participant