' demo of HC-SR04 + RTC + OLED connected to Annex32
' a complete help of Annex32 can be found here
' https://cicciocb.com/annex32help/V1.442/
maxscroll.setup 8, 21
maxscroll.print "Hello Mike! "
maxscroll.next "This should meet your needs, I guess :-) "
neo.setup 5, 16
neo.strip 0, 15, 0
i2c.setup 26,25, 400000
oled.init 0
oled.font 2
oled.refresh 0
timer0 50, scrollME
timer1 900, printtime
cnt = 0 : led = 0 : col = &hff0000 : col_p = 0
wait
'###################################################################
'-------------------------------------------------------------------
scrollME:
'-------------------------------------------------------------------
MAXSCROLL.SCROLL 5
cnt = cnt + 1
if (cnt > 3) then
cnt = 0
neo.strip 0, 15, col_p, 1
neo.strip 0, led, col, 0
led = led + 1
if (led > 15) then
led = 0
col_p = col
col = rnd(256 * 256 * 256)
endif
endif
return
'-------------------------------------------------------------------
printtime:
'-------------------------------------------------------------------
D1$=date$
D2$=replace$(date$,"/",".")
T1$=time$
T2$=word$(time$,1,":") & ":" & word$(time$,2,":")
T3$=left$(time$,5)
print D1$, D2$, T1$, T2$, T3$
wlog D1$, D2$, T1$, T2$, T3$
oled.cls
oled.print 0, 0, "Date:" + D2$
oled.print 0, 16, "Time:" + T1$
'oled.print 0, 16, "Time:" + T2$
'oled.print 0, 16, "Time:" + T3$
oled.print 0, 32, "DIST:" + str$(DISTANCE(13,12), "%4.1f")
oled.print 0, 48, "ADC:" + str$(adc(34))
oled.refresh 0
return