Ok I am getting closer. I have installed the rasperian for robots image (although I do not see a difference) and the Grove Pi Software. I have tried running the weather script located in the python folder. Here is the script
from grove_oled import *
import json
import urllib
#Get the weather
city="Orlando"
url=“http://openweathermap.org/city/4167147ando”+city
jsonurl = urllib.urlopen(url.read(“http://openweathermap.org/city/4167147ando”))
weather_desc=text[“weather”][0][“description”] # General description of the weather
temp=float(text[“main”][“temp”])-273.15 # Temperature in C
pressure=text[“main”][“pressure”] # Pressure in hPa
humidity=text[“main”][“humidity”] # Humidity %
wind_speed=text[“wind”][“speed”] # Wind speed mps
print(weather_desc,temp,pressure,humidity,wind_speed)
#Print the data on the OLED
#Initialize the OLED
oled_init()
oled_clearDisplay()
oled_setNormalDisplay()
oled_setVerticalMode()
time.sleep(.1)
line=0
oled_setTextXY(line,0)
oled_putString(“WEATHER:”)
line+=2
oled_setTextXY(line,0)
oled_putString(weather_desc[:12])
line+=1
oled_setTextXY(line,0)
oled_putString(“Temp:”+str(temp)+“C”)
line+=1
oled_setTextXY(line,0)
oled_putString(“Hum:”+str(humidity)+"%")
line+=1
oled_setTextXY(line,0)
oled_putString(“Wind:”+str(wind_speed)+“mps”)
line+=2
oled_setTextXY(line,0)
oled_putString(“Pressure:”)
line+=1
oled_setTextXY(line,0)
oled_putString(str(pressure)+“hPa”)
Here is the error I am getting
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type “copyright”, “credits” or “license()” for more information.
================================ RESTART ================================
Traceback (most recent call last):
File “/home/pi/Desktop/weather1.py”, line 34, in
jsonurl = urllib.urlopen(url.read(“http://openweathermap.org/city/4167147ando”))
AttributeError: ‘str’ object has no attribute ‘read’
Ple\us my OLED monitor is only half the screen and various dots. If the OLED is the problem, I can have it go to a screen using hdmi.
Our competition is in 2 weeks so I would really like to get this working.
Thanks