// Use this project to run precompiled AnnexBasic binary:
// Press "F1", choose "Load HEX File and Start Simulation..."
// Select a precompiled AnnexBasic binary.
// copy this script in the editor page, save and run it
pin.mode 2, output
pin.mode 15, output
pin(2) = 0 : pin(15) = 1
pos = 100: dir = 5
PWM.SETUP 22, 1, pos, 50, 12
tft.init 0
gui.init 20, black
txt = GUI.Textline(10,50,190,50, "Position:", 3)
gui.autorefresh 50
maxscroll.setup 4, 21
maxscroll.print "Annex & WOKWI"
I2C.SETUP 26, 25
OLED.INIT 1 ' init the OLED upside-down
OLED.CLS ' clear the screen
OLED.REFRESH 0
OLED.FONT 2
OLED.COLOR 1
for z = 1 to 1000
pin(2) = 1 - pin(2)
pin(15) = 1 - pin(15)
pause 200
PWM.OUT 1, pos
pos = pos + dir
if (pos < 100) or (pos > 500) then dir = -dir
gui.settext txt,"Position " + str$(pos)
MAXSCROLL.SCROLL 5
OLED.CLS
OLED.PRINT 10,10, "Position " + str$(pos)
OLED.REFRESH 0
next z
Loading
ssd1306
ssd1306