Click and hold html button to send command to particle

Hi guys,

I’m working on the project that required to have a button that when the user click and hold the button, it will keep sending string command to particle cloud. This is what I got so far:

Document Click and hold

    var counter;
    function end() {

    function display(value) {
        if (value == 1) {

            counter = setInterval(function () {
                paramStr = "f";
            }, 200);
        var requestURL = "";
        $.post(requestURL, { params: paramStr, access_token: accessToken });


Rather than sending the value continuously, have you considered sending an event on the click-down and click-up to signal the start & stop? That would save a lot of (unnecessary) traffic.

I think I know what you mean. That is a very good idea. I will try that.