Untitled

 avatar
user_5637645
plain_text
4 days ago
974 B
1
Indexable
import time
import board
import datetime

now = datetime.datetime.now()
formatted_date = now.strftime("%A, %e %B %G %-I%p")

print("Current date and time is:", formatted_date)

from atproto import Client

from adafruit_bme280 import basic as adafruit_bme280


# Set up the BME280 sensor
i2c = board.I2C()   # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c, address=0x76)


temperature = bme280.temperature
pressure = bme280.pressure
humidity = bme280.humidity
temperaturef = (temperature * 9/5) + 32
print(temperature)


client = Client()
client.login('xxxxxxxxxx.bsky.social', 'xxxx-xxxx-xxxx-xxxx')
post = client.send_post('The local weather in Kampot, Cambodia from a raspberry pi zero weather station: \n\nLocal date & time is: '+formatted_date +'\n\nTemp: '+str(round(temperature,1)) +'c / ' + str(round(temperaturef,1)) +'f'+'\nHumidity: '+str(round(humidity,1))+'%\nPressure: '+str(round(pressure,2))+ 'hPa')
Leave a Comment