简体   繁体   中英

Sending data to IoT device from user input

I would like to send the data entered in a textbox to the IoT device instead of sending "on" which is already predefined. How can I do this?

<form action="/light/on" method="POST">
  <input type="submit" value="Turn me on">
 </form>

You can change the form to be like this:

    <form action="/light/" method="POST">
        <input type="text" name="command" value="{{request.form.command}}">
        <input type="submit" value="Submit command">
    </form>

Then handle the POST request at server side accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM