-->
Page 1 of 2

PROBLEM WITH command graphics Analog Input Graph example

PostPosted: Tue Nov 15, 2016 7:10 pm
by tecnihouse
I am trying to use the command graphics of the example and throws me the following error:

Error at line 2: Failed to reach end of input expression, likely malformed input
Error at line 2: Syntax error
Error at line 2: Halted

/////////////////////////////////////////////
Code:
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
///////////////////////////////////////////////////////////

Also tested this other syntax but the same gives me error in line 3

memclear
graphics
300 300
timer 1000, [doit]

What can it be?
Thank you very much for your help

Re: PROBLEM WITH command graphics Analog Input Graph example

PostPosted: Wed Nov 16, 2016 6:30 am
by bugs
What version of BASIC are you using?

Yor first code is correct - I pasted it into a nodemcu using ESP Basic 3.0.Alpha 57.

There was a screen with "Analog in" up the left hand side, "Time (1 second)" along the x axis and a horizontal line being slowly drawn along the top of the screen.

Re: PROBLEM WITH command graphics Analog Input Graph example

PostPosted: Wed Nov 16, 2016 7:02 am
by Electroguard
Hi tecnihouse,

You can find an updated clock with correct syntax on mmiscool examples page here:
https://www.esp8266basic.com/graphic-clock-example.html

But at the heart of the clock is the time() function, and when I include this test line at the top of my scriptL
Code: Select allprint time()

it returns...

Thu Jan 01 00:00:00 1970 for me,


Perhaps that is the back to defaults ESP device time, but it may come as a disappointment if you are to see your computer clocks time.

Re: PROBLEM WITH command graphics Analog Input Graph example

PostPosted: Wed Nov 16, 2016 7:35 am
by tecnihouse
Electroguard:
I have tried to put the code of your link https://www.esp8266basic.com/graphic-clock-example.html
Code: Select all​timer 10000, [drawClock]
print "Graphic Clock"
print
graphics 500, 500


And the link http://www.esp8266.com/viewtopic.php?f=40&t=6995

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

Always same error "Failed to reach end of input expression, likely malformed input" , "Syntax error"
I have tried in chrome Version 54.0.2840.99 m and Firefox 49.0.2.

I hope some other advice or suggestion this is driving me crazy
Thanks.

PD:
Code: Select allprint time()

It works for me return :
"Wed Nov 16 12:34:20 2016"