-
• #2
Try this
//PICO v1.86 var baudrate=9600; var Port=Serial1; //var Port=Serial2; Port.setup(baudrate); //loopback jumper the tx and rx pins together to test Port.on('data', function (data) { print("Serial> "+data); }); Port.print("Hello World");
-
• #3
Are you using WEBIDE to access the PICO?
Here's another example using the options://PICO v1.86 var baudrate=9600; var Port=Serial1; var P={rx:B7, tx:B6,bytesize:8,parity:'even',stopbits:1}; //var Port=Serial2; //var P={rx:A3, tx:A2,bytesize:8,parity:'even',stopbits:1}; Port.setup(baudrate,P); //loopback jumper the tx and rx pins together to test Port.on('data', function (data) { print("Serial> "+data); }); Port.print("Hello World");
The output:
>echo(0); =undefined Serial> H Serial> e Serial> l Serial> l Serial> l Serial> o Serial> Serial> W Serial> o Serial> r Serial> l Serial> d >
1 Attachment
-
• #4
Thank you ClearMemory041063,
Yes, I use WEBIDE to access the PICO
I did your examples, and I get always the same error, either on Serial1 or on Serial2.
For example, with the file you attached, on Serial2 the error is:Uncaught Error: Function "g" not found!
at line 1 col 23
var Port=Serial2;Port.g(9600,{f:A3,i:A2,a:8,c:"even",h:1});P...^
=undefined
Any clue ?
Thanks a lot
GeekBot -
• #5
Hello,
Your question "Are you using WEBIDE to access the PICO?" inpired me to test on another environment.
The problem is linked to Windows or Chrome on Windows.
On a Chromium/Linux machine, all the demo codes work perfect.
I updated the WEBIDE, still the same.
I run Windows 10 Familly edition and my machine is up to date.
Version: 1511, OS version: 10586.545
If you need some more information, just ask.
Best regards
GeekBot -
• #6
It looks like the minifier is going berserk and renaming builtin functions. What minification option are you using? Try changing it.
-
• #7
It looks like the minifier is going berserk and renaming builtin functions
Yeah, I reckon you might have gone into settings and turned all the settings up to 'max'?
Under
minification
in settings, just turn it all tono minification
-
• #8
Hi Guys
You are right, for reasons I don't know, the minification was set to "max". I set it back to "simple optimizations" and it started to work as expected.
Thanks a lot
Regards
GeekBot -
• #9
Glad that you have found a solution.
I'm running a Windows 7 system with WebIDE.
I tried it at all levels of minification with no problem.
The only way I could get an error is if my phat fingers missed the shift key when typing the pins. b7 instead of B7. I usually run the Esprima (offline) minification.
I also tried the Serial stuff using the terminal program Putty with positive results.
Welcome to the Art of computer programming. It's art when variables won't and constants aren't :) -
• #10
Just tried it, and setting normal (not module) minification to:
Closure (online) - Advanced Minification (not recommended)
Definitely gives the error. The rest of them are probably fine.
-
• #11
Should the max minification option be removed? If it mangles builtin function names like that, it's not usable for even a simple task. Why have a setting that you know isn't usable?
-
• #12
In general: If you want to minify a JavaScript program with Google Closure Compiler in "Advanced Minification" mode then you need an *.externs file for every library which is not part of the minification step. The builtin functions are not part of the minification. So an extern file is required. Advanced minification is useless without an externs file.
I've attached an espruino.externs file which I use for module minification. But it must be built into the WebIDE code to be sent to the minification service.
I did it for module minification some time ago:
https://github.com/espruino/EspruinoDocs/blob/master/bin/minify.js#L18
https://github.com/espruino/EspruinoDocs/blob/master/bin/minify.js#L41The same simple logic must be built into the WebIDE. Then advanced minification would work there too. But I don't know the source code of the WebIDE. Sorry.
1 Attachment
Hello,
I use Epruino Pico version 1.86.
The source code is made of this unique line of code:
Serial2.setup(9600, { rx: A3, tx : A2 });
Running it leads to this error :
Same story with:
Serial2.setup(9600,{rx:A3, tx:A2,bytesize:8,parity:'even',stopbits:1});
I feel to be an idiot, since it seems so trivial to use...
Is this normal ?
Any advice is welcome.
Best regards
GeekBot