Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created November 20, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takahashim/29a83f6f0fe873229493bc90012565a3 to your computer and use it in GitHub Desktop.
Save takahashim/29a83f6f0fe873229493bc90012565a3 to your computer and use it in GitHub Desktop.
# 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