Avatar for Will

Will

Member since Mar 2016 • Last active Feb 2019
  • 7 conversations
  • 44 comments

Most recent activity

    • 6 comments
    • 362 views
  • in ESP32
    Avatar for Will

    Hi - thank you for any help you might provide. Dev board is running other code, so I pulled this from notes, not a working board.

    const SURLAPI = 'https://i66toll.firebaseio.com/eb/belt/­washington/tolls.json?orderBy=%22$key%22­&limitToLast=1';
    const HTTP = require("http");
    //ESP32.enableBLE(false);
    
    function onInit()
    {
        //console.log("main");
        //loadTolls();
    }
    
    var options = {
        host: 'i66toll.firebaseio.com', // host name
        port: 443,            // (optional) port, defaults to 80
        path: '/eb/belt/washington/tolls.json',           // path sent to server
        method: 'GET',       // HTTP command sent to server (must be uppercase 'GET', 'POST', etc)
        protocol: 'https:',   // optional protocol - https: or http:
        headers: { orderBy : "%22$key%22", limitToLast : 1 } // (optional) HTTP headers
      };
    
    function loadTolls()
    {
        //getting weather now, so allow another process to get weather
      
        HTTP.get(options, function(res) 
        {
            res.on('data', function(wunderString)
            {
              loadTolls.val = wunderString;
              console.log(wunderString);
              memUsage();
            });
            res.on('close', function(fLoaded)
            {
              memUsage();
            });
            res.on('error', function(e){console.log("error getting URL details");});    //TODO: test, and handle by saving values?
        });
    }
    
    function memUsage()
    {
      console.log(process.memory().usage);
    }
    
  • in ESP32
    Avatar for Will

    Is SSL available on ESP32? I know it wasn't at one point. If not, does anyone know URL/service that can be used to translate?

    I'm trying to pull information from https://firebaseio.com

    I get out of memory error, and have tried turning off bluetooth with no avail. Perhaps I should look into building my own?

    Using version 2.01.

    Thank you in advance.

  • in Interfacing
    Avatar for Will

    @patreon is this site still available? Can others use it?

  • in JavaScript
    Avatar for Will

    Maybe this is now possible on some of the larger devices such as the ESP 32?

  • in Projects
    Avatar for Will

    Oh, I am using the webIDE (love it), I didn't realize it would do that for me. Very cool.

  • in Projects
    Avatar for Will

    @Wilberforce good tip on the line between text. That code has room for improvement in that I might like to use regex to split the text in a more natural place.

    I do load the module dynamically, because I thought I had to. Perhaps you're suggesting I only need to do that prior to the save?

  • in Projects
    Avatar for Will

    Kind of a "quick" project to get comfortable with the ESP32.

    It connects to the wunderground API, and pulls the latest forecast string, and displays across SSD1306 (I also wrote a version with the HD44780 I2C).

    See the code here:
    https://github.com/wga22/esp8266/blob/ma­ster/espurino/ESP32_drawforecast.js

    Interesting part of the code is the parsing of the JSON from wunderground. Not my best code, just slopping something together to see how it works. Love the ESP32, has right level of performance for doing real level of work. Hoping ESPRUINO team continues to get it love! A special thanks to the brilliance of the "loadModule" versatility!

    function drawForecast()
    {
        //getting weather now, so allow another process to get weather
        setTime.val = "";
        var ZIP= '22182';
        HTTP.get((SURLAPI + ZIP + ".json"), function(res) 
        {
            res.on('data', function(wunderString) {   drawForecast.val += wunderString;   });
            res.on('close', function(fLoaded) 
            {
                console.log("Connection to wunder closed");
                drawForecast.obj = JSON.parse( drawForecast.val );
                drawForecast.val = "";
                writeStringToLCD(drawForecast.obj.foreca­st.txt_forecast.forecastday[0].fcttext);­
            });
            res.on('error', function(e){console.log("error getting wunderground details");});   //TODO: test, and handle by saving values?
        });
    }
    drawForecast.val = "";
    drawForecast.obj = null;
    
Actions