Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created Nov 20, 2019
Embed
What would you like to do?
# https://github.com/yamanekko/M5StickC-IDF-m5mruby
# https://github.com/yamanekko/mruby-m5stickc
Wire = M5StickC::TwoWire.new(0)
Wire.begin(32, 33, 100000)
LCD = M5StickC::Display.new
LCD.rotation = 1
LCD.clear
LCD.fill_screen(M5StickC::Display::BLACK)
LCD.text_color = M5StickC::Display::WHITE
LCD.text_font = 2
ESP32::System.delay(1000)
@bmp = M5StickC::BMP280.new
@bmp.begin
@dht = M5StickC::DHT12.new
while true
ESP32::System.delay(1000)
LCD.clear
LCD.cursor(1, 0)
LCD.printf "RubyConf2019 Nashville\n"
LCD.printf "Pressure: %.2f\n", @bmp.read_pressure
LCD.printf "Temperature: %.2f\n", @dht.read_temperature
LCD.printf "Humidity: %.2f\n", @dht.read_humidity
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment