Skip to content

Instantly share code, notes, and snippets.

@jrbail01
Created June 14, 2017 15:18
Show Gist options
  • Save jrbail01/e670cad11d1656f69446ecf0023f610d to your computer and use it in GitHub Desktop.
Save jrbail01/e670cad11d1656f69446ecf0023f610d to your computer and use it in GitHub Desktop.
Sense HAT Orientation Script
from sense_hat import SenseHat
sense = SenseHat()
while True:
orientation = sense.get_orientation()
print "pitch = " + str(orientation['pitch'])
print "roll = " + str(orientation['roll'])
print "yaw = " + str(orientation['yaw'])
@jollywombats
Copy link

Getting a syntax error on line 45, uncertain why other than the length of the if else statement combo, but I have extremely limited knowledge of python. Any suggestions?

pi@RPI-TempMon:~ $ sudo python enviro_phat.py
File "enviro_phat.py", line 45
if (temp_c > -15) and (temp_c < 100): streamer.log(":sunny: " + SENSOR_NAME + " Temperature(C)", temp_c) streamer.log(":sunny: Calibrated " + SENSOR_NAME + " Temperature(C)", temp_c_cal) else: temp_f = temp_c * 9.0 / 5.0 + 32.0 temp_f_cal = temp_c_cal * 9.0 / 5.0 + 32.0 # print("Temperature(F) = " + str("{0:.2f}".format(temp_f))) if (temp_f > 0) and (temp_f < 110):
^
SyntaxError: invalid syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment