Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By Mmiscool
#49039 Simple demo to produce a graph from the analog input pin.

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.

Code: Select allmemclear
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


2016-06-11 23_37_09-206.53.79.172_input_.png
You do not have the required permissions to view the files attached to this post.
User avatar
By electronrancher
#52251 Hi,

I tried this demo to double check the lag problem I was working on before - it seems to show something similar.

Paste code, save, and click run - shows the axes with a point or two plotted. Browser page goes blank for about 10 seconds with Waiting.. Connecting... messages in bottom corner (firefox). Eventually shows up again fully plotted and random lag starts again. The refresh is not a constant pace, and it looks like many refreshes are skipped while waiting for one to finally connect and update.

This is Basic version 3 on a nodemcu lua, but I get similar performance on a generic ESP-12E or 07. I get similar performance on firefox, safari, or chrome.

I am certain that this is not the intended behavior, right? Can you give any advice? This nodemcu is one of my test benches, so I am confident in it's connectivity, operation, power supply, etc. Any advice would be appreciated - I've got a lot of uses for this tool!
User avatar
By Mmiscool
#53111 I think you will find that the current version. 3.0a41 is significantly faster that previous versions.

I just put out a new build tonight that fixes a problem with the debugger not showing the graphics area until a manual page refresh.

Give it a shot and let me know how its working for you.