Saturday, 24 February 2018
Saturday, 10 February 2018
Central Coast, Tasmania
Goat Island
Penguin
Penguin has a minature railway, who knew ?
Not running today :-(
"Penguins is practically chickens"
Saturday, 3 February 2018
Thursday, 1 February 2018
ESP Basic analog clock on TFT display
Reusing arduino analog clock code from years ago on ESP Basic.
Yeah I know... BASIC right ?, but honestly as a quick way of getting something happening on the ESP it is one of the simplest ways available.
time.setup(+11,0)
tft.setup(16,4,3)
tft.text.color(tft.rgb(55,155,67))
tft.text.font(1)
WHITE=tft.rgb(255,255,255)
gosub [showtime]
timercb 60000 , [showtime]
wait
[showtime]
tft.cls()
tvx = 320/2
tvy = 240/2
tvradius = 240/2 - 2
'clock face
tft.circle(tvx,tvy,tvradius,WHITE)
gosub [ticks]
minute = time("minute")
hour=time("hour")
second=time("second")
'angle = second * 6
'Convert degrees to radians
'angle = (angle/57.29577951)
'x3 = (tvx+(sin(angle)*(tvradius-6)))
'y3 = (tvy-(cos(angle)*(tvradius-6)))
'tft.line(tvx,tvy,x3,y3,WHITE)
angle = minute * 6
angle = (angle/57.29577951) 'Convert degrees to radians
x3 = (tvx+(sin(angle)*(tvradius-11)))
y3 = (tvy-(cos(angle)*(tvradius-11)))
tft.line(tvx,tvy,x3,y3,WHITE)
angle = hour * 30 + int((minute / 12) * 6 )
angle = (angle/57.29577951) 'Convert degrees to radians
x3 = (tvx+(sin(angle)*(tvradius-40)))
y3 = (tvy-(cos(angle)*(tvradius-40)))
tft.line(tvx,tvy,x3,y3,WHITE)
return
[ticks]
'hour ticks
z = 0
n = 12
do
'Begin at 0 and stop at 360
angle = z
angle=(angle/57.29577951) 'Convert degrees to radians
x2=(tvx+(sin(angle)*tvradius))
y2=(tvy-(cos(angle)*tvradius))
x3=(tvx+(sin(angle)*(tvradius-5)))
y3=(tvy-(cos(angle)*(tvradius-5)))
tft.line(x2,y2,x3,y3,WHITE)
tft.text.cursor(x3,y3)
tft.print( str(n) )
if n == 12 then n = 0
n = n + 1
z = z + 30
loop while z < 360
return
Yeah I know... BASIC right ?, but honestly as a quick way of getting something happening on the ESP it is one of the simplest ways available.
time.setup(+11,0)
tft.setup(16,4,3)
tft.text.color(tft.rgb(55,155,67))
tft.text.font(1)
WHITE=tft.rgb(255,255,255)
gosub [showtime]
timercb 60000 , [showtime]
wait
[showtime]
tft.cls()
tvx = 320/2
tvy = 240/2
tvradius = 240/2 - 2
'clock face
tft.circle(tvx,tvy,tvradius,WHITE)
gosub [ticks]
minute = time("minute")
hour=time("hour")
second=time("second")
'angle = second * 6
'Convert degrees to radians
'angle = (angle/57.29577951)
'x3 = (tvx+(sin(angle)*(tvradius-6)))
'y3 = (tvy-(cos(angle)*(tvradius-6)))
'tft.line(tvx,tvy,x3,y3,WHITE)
angle = minute * 6
angle = (angle/57.29577951) 'Convert degrees to radians
x3 = (tvx+(sin(angle)*(tvradius-11)))
y3 = (tvy-(cos(angle)*(tvradius-11)))
tft.line(tvx,tvy,x3,y3,WHITE)
angle = hour * 30 + int((minute / 12) * 6 )
angle = (angle/57.29577951) 'Convert degrees to radians
x3 = (tvx+(sin(angle)*(tvradius-40)))
y3 = (tvy-(cos(angle)*(tvradius-40)))
tft.line(tvx,tvy,x3,y3,WHITE)
return
[ticks]
'hour ticks
z = 0
n = 12
do
'Begin at 0 and stop at 360
angle = z
angle=(angle/57.29577951) 'Convert degrees to radians
x2=(tvx+(sin(angle)*tvradius))
y2=(tvy-(cos(angle)*tvradius))
x3=(tvx+(sin(angle)*(tvradius-5)))
y3=(tvy-(cos(angle)*(tvradius-5)))
tft.line(x2,y2,x3,y3,WHITE)
tft.text.cursor(x3,y3)
tft.print( str(n) )
if n == 12 then n = 0
n = n + 1
z = z + 30
loop while z < 360
return
Subscribe to:
Posts (Atom)