예제 #1
0
def send(Name, Loc, Time):
    WeatherStr = Weather.GetWeather(Loc)
    UserName = Wechat.GetUserName(Name)
    if (UserName == False):
        print("This user doesn't exist!")
    else:
        Wechat.SendWechatMessage(WeatherStr, UserName, Name, Time)
예제 #2
0
def __main__():
    GPIO.setmode(GPIO.BCM)
    GLCD.PinsInit(20, 7, 8, 9, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17)
    GLCD.GLCDInit()
    GLCD.GLCDDisplayClear()

    SW.PinsInit(21, 22, 23, 24, 25, 26, 27)
    SW.Start()

    roop = 10 * 60 * 60
    mode = 1
    try:
        while True:
            key = SW.GetKey()
            if key == "1":
                GLCD.GLCDDisplayClear()
                mode += 1
                if mode > 3:
                    mode = 1

            if mode == 1:
                if roop >= 10 * 60 * 60:
                    Weather.RequestAPI()
                    weather = Weather.GetWeather()
                    temp = Weather.GetTemp()
                    roop = 0

                GLCD.GLCDPuts(1, 0, "Date :")
                GLCD.GLCDPuts(5, 8,
                              datetime.datetime.now().strftime('%Y:%m:%d %A'))
                GLCD.GLCDPuts(1, 16, "Weather :")
                GLCD.GLCDPuts(10, 24, weather)
                GLCD.GLCDPuts(10, 32, "Temp : " + format(temp) + 'C')
                GLCD.GLCDPuts(
                    1, 40,
                    "Time : " + datetime.datetime.now().strftime('%H:%M:%S'))
                GLCD.GLCDPuts(1, 48, "Humidity    : " + AM2320.GetHum() + '%')
                GLCD.GLCDPuts(1, 56, "Temperature : " + AM2320.GetTemp() + 'C')

                roop += 1
            elif mode == 2:
                cal = calendar.month(datetime.datetime.now().year,
                                     datetime.datetime.now().month)
                cals = cal.split("\n")
                y = 0
                for c in cals:
                    GLCD.GLCDPuts(1, y, c)
                    y += 8

            elif mode == 3:
                GLCD.drowMashiro()

            time.sleep(0.1)
    except KeyboardInterrupt:
        SW.Stop()
        GLCD.GLCDDisplayClear()
        GPIO.cleanup()
예제 #3
0
 def Forecast(self):
     return Weather.GetWeather(city_code1)  # get weather data
예제 #4
0
            openGMail.openSiteGMail()

        elif 'time' in command:
            tellTime.sayTime()

        elif 'who are you' in command:
            defineYourself.defineYou()

        elif "camera" in command or "take a photo" in command:
            ec.capture(0, "robo camera", "img.jpg")

        elif 'on youtube' in command or 'from youtube' in command:
            ytSearch.searchingVideo(command)

        elif 'weather' in command:
            Weather.GetWeather()

        elif "restart" in command:
            restart.Logout()

        elif "hibernate" in command or "sleep" in command:
            hibernate.Logout()

        elif "log off" in command or "sign out" in command:
            LogOff.Logout()

        elif "where is" in command or "locate" in command:
            Maps.Maps(command)

        elif 'shutdown' in command or 'power off' in command:
            shutdown.Logout()