Add new comment

Hello World

Submitted by Erik Wegner on
Aufmacherbild

Der folgende Code schreibt einen Text auf ein OLED-Display:

sda = 2
scl = 1
i2c.setup(0, sda, scl, i2c.SLOW)
sla = 0x3c
disp = u8g.sh1106_128x64_i2c(sla)
tmr.create():alarm(1000, tmr.ALARM_AUTO, function() 
uart.write(0, "timer\n")
disp:firstPage()
repeat
    disp:setFont(u8g.font_6x10)
    disp:setFontRefHeightExtendedText()
    disp:setDefaultForegroundColor()
    disp:setFontPosTop()
    disp:drawStr( 0, 20, "Hello World!");
until disp:nextPage() == false     
end)

Erforderlich in der Firmware sind die Module: i2c, u8g, tmr, uart

Associated categories

Add new comment

About text formats

Activitypub

  • Allowed HTML tags: <a href hreflang> <em> <strong> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
About text formats

Activitypub

  • Allowed HTML tags: <a href hreflang> <em> <strong> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.