• All this is basic work for the Cryptographic Protocol on a PICO project.
    This project needs a way to post 80 character messages and reply with the same.
    http://forum.espruino.com/conversations/­291068/

    It is posted as a separate project as it may have use in other projects without being entangled in the cryptography.

    The Server
    htmlServerA1.js 1 Sep 2016
    for use with a PICO or espruino board with ESP8266
    When executed if IP=192.168.1.5, use the following in the browser
    //http://192.168.1.5:8080/
    And use IP="192.168.1.5"; in Postw4.js
    Configure the following:
    //Flag to test with browser controls the HTML page that is served to a browser
    //var Bflag=0; //use with kryptomessage,js
    var Bflag=1; //test with browesr
    //Select the hardware options
    //var Hardware=0; //Espruino board
    var Hardware =1; //PICO
    //Set up access to wifi router
    var SSID="router name";
    var key= "router key";
    The output of htmlServerA1.js

    echo(0);
    Start
    Start connection process
    Try again
    =undefined
    Reset the ESP8266
    Connecting to WiFi
    Wi-Fi Connected
    IP=  192.168.1.5
    Null
    

    Use a browser and point it to http://192.168.1.5:8080/
    You will get one of two html pages depending on the Bflag setting.
    If you set Bflag=1 the page will contain a title, and three buttons.
    The bad button posts 70 characters and returns “1234”.
    The good button posts 80 characters and returns all 80 characters.
    Postw4.js simply does the post.
    Postw4.js 1 Sep 2016
    This does a POST to the server running on another device.
    Use with PICO or espruino board with ESP8266.
    You will need to configure the following parameters.
    setup IP address of server
    IP="192.168.1.5";
    //Select length of message
    var clength=8; //good
    //var clength=7; //bad
    // Select Espruino Bd or Pico hardware
    //var Hardware=0; //Espruino board
    var Hardware =1; //PICO
    //setup WiFi access parameters
    var SSID="wifi router name";
    var key= "wifi key";

    Output with clength=8

    >echo(0);
    Start
    Start connection process
    Waiting for ESP8266 response
    =undefined
    Reset the ESP8266
    Connecting to WiFi
    Wi-Fi Connected
    80
    IP=  192.168.1.4
    null
    send
    Closed: 0123456789012345678901234567890123456789­0123456789012345678901234567890123456789­
    

    2 Attachments

About