obniz developer team
Published

Display a message on the M5StickC screen when tweet

When a specific user tweets a new tweet, it will appear on the M5StickC display and notify you.

BeginnerFull instructions provided1 hour1,036
Display a message on the M5StickC screen when tweet

Things used in this project

Story

Read more

Code

Untitled file

HTML
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="https://obniz.io/js/jquery-3.2.1.min.js"></script>
    <script
      src="https://unpkg.com/obniz@3.x/obniz.js"
      crossorigin="anonymous"
    ></script>
  </head>
  <body>
    <script>
      let obniz = new Obniz.M5StickC("OBNIZ_ID_HERE");
      obniz.onconnect = async () => {
        if (typeof req === "object") {
          if (req.body.tweet) {
            console.log("New tweet");
            console.log(req.body);
      
            obniz.display.clear();
            obniz.display.print("New tweet!");
            obniz.display.print("content:");
            obniz.display.print(req.body.content);
            await obniz.wait(5000);
          }
        } else {
          console.log("failed");
        }
      
        if (typeof done === "function") {
          done();
        }
      };
    </script>
  </body>
</html>

Credits

obniz developer team

obniz developer team

80 projects • 32 followers
Development board "obniz" is controlled via the internet.

Comments