Avatar for Aleksandrs

Aleksandrs

Member since Sep 2016 • Last active Dec 2016
  • 10 conversations
  • 41 comments

Most recent activity

  • in ESP8266
    Avatar for Aleksandrs

    I have litle bug i don`t understand ...

    1. function startDevice(){
    2. require( fs.item('Generalscript').module() );
    3. var Generalscript = require("Generalscript").Generalscript;
    4. var gs = new Generalscript();
    5. gs.getVer();
    6. }
    7. Uncaught Error: Both arguments to addCached must be strings
    8. at line 1 col 41
    9. Modules.addCached(this.k,this.toString()),this.k;
    10. ^
    11. in function "module" called from line 1 col 42
    12. require( fs.item('Generalscript').module() );
    13. ^
    14. in function "startDevice" called from line 23 col 24
    15. startDevice();
    16. ^
    17. in function called from system
    • 10 comments
    • 6.37k views
    @Aleksandrs replied
  • in ESP8266
    Avatar for Aleksandrs

    I now found my problem .. MQ135 Analog Out is 0-5V, ESP8266 Analog Read only from 0-1V ... now please help to rising this questions.. need Resistor divider?

    • 4 comments
    • 3.01k views
    @Aleksandrs replied
  • in ESP8266
    Avatar for Aleksandrs

    I found answer.. http://forum.espruino.com/conversations/283045/

    I just use

    1. if need update
    2. var fs = new(require("FlashStoreWrite"))(0x7c000);
    3. // Save module source in EEPROM
    4. fs.item('MyGeneralScript').wget('http://MyScript location');
    5. E.on('init', function() {
    6. var fs = new(require("FlashStore"))(0x7c000);
    7. require( fs.item('MyGeneralScript').module() );
    8. var MY = require("MyGeneralScript");
    9. });

    Full my code:

    1. // Init ESP8266
    2. var ESP8266 = require("ESP8266");
    3. //ESP8266.setLog(1);
    4. //ESP8266.printLog();
    5. E.setClock(80);
    6. // 18:FE:34:Cb:33:66
    7. var fs = new(require("FlashStoreWrite"))(0x7c000);
    8. var rfs=new(require("FlashStore"))(0x7c000);
    9. var Config = rfs.item('config').valueOf();
    10. console.log(Config);
    11. var sleep = 0;
    12. var objectToSend = {};
    13. objectToSend.id = 'd03';
    14. // Init WiFi Networks
    15. var wifi = require("Wifi");
    16. wifi.setHostname(objectToSend.id);
    17. wifi.connect("XXX", {password:"XXX"}, function(err){
    18. setTimeout(function(){
    19. objectToSend.internalIp = wifi.getIP();
    20. //console.log("connected? err=", err, "info=", wifi.getIP());
    21. initDevice();
    22. },2000);
    23. });
    24. wifi.stopAP();
    25. wifi.save();
    26. function initDevice(){
    27. var http = require("http");
    28. http.get("MYLINK", function(res) {
    29. res.on('data', function(data) {
    30. var tt = JSON.parse(data);
    31. sleep = tt.sleep; // Set sleep time
    32. if(tt.ver>Config.ver){
    33. console.log("GETTING NEW FIRMWARE");
    34. fs.item('config', tt);
    35. // Save new general scipt
    36. fs.item('Generalscript').wget('LINK TO MY SCRIPT');
    37. }
    38. if(tt.debug==1){
    39. console.log("DEBUG");
    40. digitalWrite(D2,0); // Enable LED
    41. startDevice();
    42. }else{
    43. digitalWrite(D2,0); // Disable LED
    44. startDevice();
    45. }
    46. });
    47. });
    48. }
    49. function startDevice(){
    50. // Retrieve module source, add to module cache and then use..
    51. require( fs.item('Generalscript').module() );
    52. var GeneralScript = require("Generalscript").Generalscript;
    53. var gs = new GeneralScript();
    54. gs.getVer();
    55. }
  • in ESP8266
    Avatar for Aleksandrs

    Yes i have 2x device in my home he is WiFi.. sets getting temperature... every time he from Deep sleep he going to my web server and check last Script..,, in WEB server i have Mydevice.min.js and need to be flash automatically.

  • in ESP8266
    Avatar for Aleksandrs

    Yes this is good idea..

    • 5 comments
    • 3.44k views
    @Aleksandrs replied
    • 8 comments
    • 5.56k views
    @allObjects replied
Actions