-->
Page 1 of 9

simple graphic clock

PostPosted: Sun Dec 06, 2015 11:42 pm
by cwilt
Just getting started.

Code: Select allprint "Graphic Clock"
print
graphics 500 500
gcls
gosub [drawhour]
gosub [drawminute]
end

[drawhour]
mytime = time("hour")
x = mytime * 15
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy
return

[drawminute]
mytime = time("min")
x = mytime * 6
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy 12
return

Re: simple graphic clock

PostPosted: Mon Dec 07, 2015 12:32 am
by heckler
Very nice!
that's some fancy math.

runs on an esp -01 module

dwight

Re: simple graphic clock

PostPosted: Mon Dec 07, 2015 1:37 am
by Mmiscool
Modified your demo so it will update the clock face every 5 seconds.

Do you mid if I post this demo on the esp8266 basic web site?

Code: Select allonload [drawClock]
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
print "Graphic Clock"
print
graphics 500 500
[drawClock]
gcls
gosub [drawhour]
gosub [drawminute]
wait

[drawhour]
mytime = time("hour")
x = mytime * 15
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy
return

[drawminute]
mytime = time("min")
x = mytime * 6
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy 12
return

Re: simple graphic clock

PostPosted: Mon Dec 07, 2015 7:01 am
by cwilt
Mmiscool wrote:Modified your demo so it will update the clock face every 5 seconds.

Do you mid if I post this demo on the esp8266 basic web site?

Code: Select allonload [drawClock]
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
print "Graphic Clock"
print
graphics 500 500
[drawClock]
gcls
gosub [drawhour]
gosub [drawminute]
wait

[drawhour]
mytime = time("hour")
x = mytime * 15
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy
return

[drawminute]
mytime = time("min")
x = mytime * 6
x = x / 57.29577951
xx = sin(x)
xx = xx * 200
xx = 250 + xx
yy = cos(x)
yy = yy * 200
yy = 250 - yy
line 250 250 xx yy 12
return


Thats what I had planned to do with it but I ran out of time last night.

Of course you can use it.