편집 기록

편집 기록
  • 프로필 정토드님의 편집
    날짜2018.06.12

    특정시간에서 실행(파이썬)


    라즈베리 파이에서 알람시간을 파이썬으로 코딩중인데 while문 작성이 너무 힘들네요. 어디가 잘못 된건지 설명부탁 드립니다 .

    import time
    
    import datetime
    
    from grovepi import*
    
    import math
    
    buzzer_pin =2
    
    button=4
    
    pinMode(buzzer_pin,"OUTPUT")
    
    pinMode(button,"INPUT")
    
    
    
    c=int(input("Enter the hour you want to wake up at :"))
    
    d=int(input("Enter the minutes you want to wake up at :"))
    
    b=int(input("Enter the seconds you want to wake up at :"))
    
    now= datetime.datetime.now()
    
    
    
    h=now.strftime('%H')
    
    h1=now.strftime('%M')
    
    h2=now.strftime('%S')
    
    while h==c and h1==d and h2>=b:
    
        h==c and h1==d and h2<=b
    
        digitalWrite(buzzer_pin,1)
    
        button_status = digitalRead(button)
    
        if button_status :  
    
            digitalWrite(buzzer_pin,0)
    
  • 프로필 알 수 없는 사용자님의 편집
    날짜2018.06.11

    특정시간에서 실행(파이썬)


    라즈베리 파이에서 알람시간을 파이썬으로 코딩중인데 while문 작성이 너무 힘들네요. 어디가 잘못 된건지 설명부탁 드립니다 .

    import time

    import datetime

    from grovepi import*

    import math

    buzzer_pin =2

    button=4

    pinMode(buzzer_pin,"OUTPUT")

    pinMode(button,"INPUT")

    c=int(input("Enter the hour you want to wake up at :"))

    d=int(input("Enter the minutes you want to wake up at :"))

    b=int(input("Enter the seconds you want to wake up at :"))

    now= datetime.datetime.now()

    h=now.strftime('%H')

    h1=now.strftime('%M')

    h2=now.strftime('%S')

    while h==c and h1==d and h2>=b:

    h==c and h1==d and h2<=b
    
    digitalWrite(buzzer_pin,1)
    
    button_status = digitalRead(button)
    
    if button_status :  
    
        digitalWrite(buzzer_pin,0)