Avatar for Ollie

Ollie

Member since Jul 2014 • Last active Jul 2019
  • 29 conversations
  • 514 comments

Most recent activity

  • in General
    Avatar for Ollie

    Do you mean write code for the MDBT42Q in Python? If so, this is probably not the forum for you. Check out micropython which will run on similar devices to Espruino, though I don't know about MDBT42Q.

    What I would say is you can accomplish the same objectives using Espruino & Javascript which is arguably a more useful learning curve, and you'll get plenty of help in this forum so stick around :)

  • in ESP8266
    Avatar for Ollie

    It is probably just a case of modifying the codebase you are using. Here is some code that runs ESP8266 as station and access point.

    let ap_ssid="test";
    let ap_authMode="wpa_wpa2";
    let ap_pwd="testtest";
    
    let st_ssid="ssid";
    let st_pwd="pwd";
    
    let port=8080;
    
    let http = require('http');
    let wifi = require("Wifi");
    
    let startServer = function(port){
      let server = http.createServer(function (req, res) {
          res.writeHead(200, {'Content-Type': 'text/html'});
          res.end(`AP IP: ${wifi.getAPIP().ip}</br>STA IP: ${wifi.getIP().ip}`);
      });
      console.log("server started");
      server.listen(port);
    };
    
    console.log("disconnecting all..");
    wifi.disconnect();
    
    // start ap
    wifi.startAP(ap_ssid,{
      "authMode" : ap_authMode,
      "password" : ap_pwd
    },(err)=>{
      if (!err) {
        console.log("AP started");
      } else {
        console.log("could not start AP"); 
      }
      
      // conect as station
      wifi.connect(st_ssid, {password:st_pwd}, (err) => {
        if (!err){
          console.log("station connected");
          startServer(port);
        }else{
          console.log("could not connect as station");
        }
      });
    });
    
    

    The server/page can be connected to on AP IP: 192.168.4.1 (port 8080) and the router allocated IP of 192.168.1.34 in this example.

    Both the AP IP and station IP are displayed in the page.

    AP IP: 192.168.4.1
    STA IP: 192.168.1.34
    

    Perhaps you can modify from here to suit your needs.

  • in ESP8266
    Avatar for Ollie

    I'm pretty sure ESP8266 can function simultaneously in both station and access point mode?
    Indeed I think that may be the default mode. Use wifi.getStatus and check mode. You are looking for sta+ap.

  • in Projects
    Avatar for Ollie

    Your readings will be impacted by the environment, and will fluctuate, so the first thing you want to do is zero/rebase your readings. I don't think you can get a heading, but not withstanding that, once rebased you should be able to detect incremental changes. Obviously moving the puck (to another location) or introducing magnetic things near to the Puck will impact the reading again, so you'd need to beware of this.

  • in ESP8266
    Avatar for Ollie

    There's also this proxy which may work for you. http://httptohttps.mrtimcakes.com/ by espruino forum member @MrTimcakes

  • in ESP8266
    Avatar for Ollie

    Ok, glad sorted. Re https, there's not enough memory on the device for the certificate management. You can use official Espruino Wifi board, and I think also supported on ESP32.

  • in ESP8266
    Avatar for Ollie

    I think ESP8226 build does not support encodeURIComponent(). See the docs - not available on devices with low flash memory. Try it without.

  • in ESP8266
    Avatar for Ollie

    Can you get a 200 response using a tool like Postman or Insomnia with the same endpoint? That's the first thing I'd check. That error suggests host is not found.

    Also, but without knowing, I'd also check whether http is supported by Telegram. I would expect an API like that to use https (in which case you have a problem on ESP8266).

  • in ESP8266
    Avatar for Ollie

    You can't AFAIK but I've not found it to be an issue. Maybe I've been lucky with the hardware flash chips on my boards. I've got Wemos D1 mini clones and NodeMCU boards all of which are a couple of years old now.

  • in Projects
    Avatar for Ollie

    It's great that you took the time to add the parts list in the repo. Will surely be useful to others wanting to have a go at this!

Actions