User Tools

Site Tools


eolab:weather_station:makerere:start

This is an old revision of the document!


Makerere

List of Components

Raspberry

First Program

Rain Bucket

intro.py
import time
import RPi.GPIO as GPIO
 
BUCKET_PIN = 7
 
GPIO.setmode(GPIO.BOARD)
 
GPIO.setup(BUCKET_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
 
def bucket_back(channel):
    print("Back")
 
GPIO.add_event_detect(BUCKET_PIN, GPIO.RISING, callback=bucket_back)
 
try:
    while True:
        time.sleep(0.1)
except KeyboardInterrupt:
    pass
 
GPIO.cleanup()
eolab/weather_station/makerere/start.1782826129.txt.gz ยท Last modified: 2026/06/30 15:28 by harley.lara