Create a gist now

Instantly share code, notes, and snippets.

@insom /
Created Dec 20, 2016

What would you like to do?
Micropython Temperature Logger
import gc
import webrepl
from machine import Pin, I2C
from bme280 import BME280
from socket import socket, AF_INET, SOCK_DGRAM
from time import sleep
bus = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
b = BME280(i2c=bus)
s = socket(AF_INET, SOCK_DGRAM)
s.connect(('', 5555))
while True:
require 'socket'
ss ='', 2003)
us =
us.bind('', 5555)
while x = us.recvfrom(100)[0]
next if x.empty?
right = x.split('C').first
p ("mobile.bme280 #{ right } #{ }\n")
ss.write("mobile.bme280 #{ right } #{ }\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment