Avatar for DrAzzy

DrAzzy

Member since Feb 2014 • Last active May 2019

I'm Spence Konde aka Dr. Azzy

I live and work in the People's Republic of Cambridge, near Boston, MA. I test the web gateway and web development framework for a database software firm for my day job, and sell PCBs and do electronics stuff on the side. I also own pinball machines, with all the maintenance that entails, and have made modifications to them as well.

In addition to Espruino, I do a lot of work with the Arduino platform and maintain a core that supports almost all ATTiny microcontrollers for the Arduino IDE.

I'm not a real doctor (I'd be happy to write you a prescription - but it'll be on the back of a cocktail napkin, and it'll be for a cocktail);

In a past life when I played Ragnarok Online, I wrote the AzzyAI homunculus and mercenary AI, which was used by thousands of players worldwide (ie, I'm that Azzy)

Most recent activity

  • in JavaScript
    Avatar for DrAzzy

    I know I used to know how to do this, but I've been in Arduino land a lot lately, and now this is puzzling me... I am sure there's a right way.

    I have serial data coming in. Each message will consist of a number of characters terminated with a newline.
    What I do on Arduino is load the characters one at a time into the incoming message buffer, and if the character is a newline, instead of doing that, I send the buffer off for processing.

    But on Espruino, I might get multiple characters at once - which means I could get the end of one message and the start of the next. What's the smart way to handle this? I'm sure it's a common thing that people have done, and settled on the obvious solution.

    Is there really no better way than using one of the substring functions to cut one character at a time off of the incoming data, and then apply the arduino-style logic? This seems uglier than I'd expect for Espruino.

    My initial reaction is that handling serial data on Espruino is much harder than in Arduino land, where you can just pick off a character at a time and easily process it - but I suspect I'm thinking about it wrong.

    Thanks

  • in General
    Avatar for DrAzzy

    Wow. It seems like everyone's using MQTT. It looks absurdly complicated - mqtt.org's documentation looks nigh impenetrable. Where do you guys go to get an understanding of the most relevant parts of it for IoT and how to implement it?

  • in General
    Avatar for DrAzzy

    The question is how to pass commands to the Espruino, and receive info from it, over the internet... without exposing the Espruino to incoming connections.

    Here's what I've done:
    Espruino receives commands by http requests over the LAN - these can either return data or do things.

    For getting data, there are a number of php scripts (one for each data-getting-request on the Espruino) which, if the request comes from the correct IP address, will take a base64-encoded string (the response from the Espruino), decode it, and store it with apc_store(). And there are an equal number of php scripts that return that data (in the same format as the Espruino returns it, so I can use the same page inside the LAN and outside, by using different URLs depending on window.location.hostname).

    For sending commands, there's one php script that stores a command (this would be the url that would be requested from within the LAN to affect the desired result - again to allow the same page to easily work both inside and outside the LAN) via apc, and another which gets and clears this list.

    Finally, a raspberry pi within the lan has cronjobs that call python scripts, which get data from the Espruino, base64 encode it, and pass it to the php scripts on the outside webserver, and one that grabs the command list, and if not empty, makes the requests that are specified.

    It appears to work, as long as I avoid making two requests to the Espruino simultaneously....

  • in General
    Avatar for DrAzzy

    I think there may have been a confluence of issues here - it looks like dns wasnt working correctly. I had to switch where it got the time from anyway, so i did that. Also, the wiz550io seems to behave badly when the espruino is reset (losing sockets) and requires power to be removed for an awkward length of time to reset.

    If theres a way to reset the wiznet controller from software, i think espruino needs to do that when initializing it. If not, im going to wire up the nRST pin of the wiz550io and reset it that way before i start talking to it

  • in General
    Avatar for DrAzzy

    And now very mysteriously, it seems to be working. What sorcery is this?!

  • in General
    Avatar for DrAzzy

    Okay, nevermind, it's failing constantly now and I can't figure out why.

    And I can sometimes for a short time get things with browser, but python script can't for reasons entirely unclear to me

Actions