This will sample the pin once every second.
Edit: 8-16-2016. Changed program so it would not just keep creating new graphics windows in page each time it reset the x access.
memclear
graphics 300,300
timer 1000, [doit]
[top]
x = 0
gcls
text 10,100,"Anolog in",180 + 90
text 100, 250, "Time (1 second)",0
wait
[doit]
aOLD = a
a = io(ai) / 4
xOLD = x
x = x + 10
line xOLD,aOLD,x,a,5
if x > 300 then goto [top]
wait
http://esp8266basic.com
A BASIC interpreter for your ESP
Working now on Autodrop3d. A 3d printer with automatic part ejection system. https://autodrop3d.com