Post about your Basic project here

Moderator: Mmiscool

User avatar
By Mmiscool
#37138 This is great.

Glad you did not give up on the i2c stuff. I still am not all too clear on the i2c stuff but it seems like the pas thru arduino functions are working.
User avatar
By viscomjim
#37637 Here is new code that adds the blinking colon. It blinks every second (on 500ms - off 500ms). Every 10 seconds, it refreshes the display. You can tell this when the colon is on for about 3 seconds, its updating. Up next, 12 hour with am/pm indicator and upon power up, it will display the ip address by displaying first, ie, 198, then 162, then 1, then 24, or whatever its ip address is.

Code: Select allmemclear
cls
col = 0
count = 0
'initialize display
address = 112 
i2c.begin(address)
i2c.write(33)
i2c.end()
i2c.begin(address)   
i2c.write(129)
i2c.end()
i2c.begin(address) 
i2c.write(239) 
i2c.end()
delay 10

timesetup(-5,0)
delay 750

timer 500 [coldot]

wait

[coldot]
if col = 0 then dot = 0 else dot = 2
i2c.begin(address)
i2c.write(4)
i2c.write(dot)
i2c.end()
delay 10
if col = 1 then col = 0 else col = 1
count = count + 1
if count = 20 then goto [refresh]
wait


[refresh]
cls
button "Exit " [Exit]
print time()
disp = time()
z = mid(disp,13,1) 'hour ones
gosub [conv]
b = x

z = mid(disp,12,1) 'hour tens
gosub [conv]
a = x

z = mid(disp,16,1) 'minutes ones
gosub [conv]
d = x

z = mid(disp,15,1) 'minutes tens
gosub [conv]
c = x

i2c.begin(address)
i2c.write(0)
i2c.write(a)
i2c.end()
delay 10
i2c.begin(address) 
i2c.write(2)
i2c.write(b)
i2c.end()
delay 10
i2c.begin(address) 
i2c.write(6)
i2c.write(c)
i2c.end()
delay 10
i2c.begin(address) 
i2c.write(8)
i2c.write(d)
i2c.end()
count = 0

wait

[Exit]
timer 0
wprint "<a href='/'>Menu</a>"
end

[conv]
if z = 0 then x = 63
if z = 1 then x = 6
if z = 2 then x = 91
if z = 3 then x = 79
if z = 4 then x = 102
if z = 5 then x = 109
if z = 6 then x = 125
if z = 7 then x = 7
if z = 8 then x = 127
if z = 9 then x = 111 
return


small shitty video...

https://www.youtube.com/watch?v=TCv0o4aUWtc

jim
Last edited by viscomjim on Sat Jan 02, 2016 3:22 pm, edited 1 time in total.