Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By cwilt
#35848 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
User avatar
By Mmiscool
#35853 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
User avatar
By cwilt
#35861
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.