Исходные: Имеется -raspberry pi 2b+, датчик температуры DS18B20, анемометр (на герконах), датчик наличия осадков (геркон), датчик направления ветра (герконы 8 направлений). -скрипты на питоне для снятия температуры, скорости ветра, наличия осадков. https://www.raspberrypi.org/learning/weather-station-guide/ ТЗ: -Разработать сайт для визуализации всех метеоданных. Пример: Спойлер: Скрипты Количество осадков: #!/usr/bin/python import RPi.GPIO as GPIO pin = 6 count = 0 def bucket_tipped(channel): global count count = count + 1 print (count * 0.2794) GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP) GPIO.add_event_detect(pin, GPIO.FALLING, callback=bucket_tipped, bouncetime=300) Скорость ветра: import RPi.GPIO as GPIO import time, math pin = 5 count = 0 def calculate_speed(r_cm, time_sec): global count circ_cm = (2 * math.pi) * r_cm rot = count / 2.0 dist_km = (circ_cm * rot) / 100000.0 # convert to kilometres km_per_sec = dist_km / time_sec km_per_hour = km_per_sec * 3600 # convert to distance per hour return km_per_hour def spin(channel): global count count += 1 print (count) GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP) GPIO.add_event_detect(pin, GPIO.FALLING, callback=spin) interval = 5 while True: count = 0 time.sleep(interval) print (calculate_speed(9.0, interval), "kph") Температура ## The name of the directory might be different on different devices. Check the name by using: ## ls /sys/bus/w1/devices directory = "28-00000717878a" ## Open the file and store the first line with open("/sys/bus/w1/devices/"+directory+"/w1_slave") as file: lines = file.readlines() temp = lines[1] # find where the temperature is recorded in the line and store the position position = temp.find("t=") + 2 # Extract the numerical value and convert to a float temperature = float(temp[position:].rstrip()) print(float(temperature)/1000)