Javascript to display last value of a ThingSpeak channel on web page | ThingSpeak API

4 ビュー (過去 30 日間)
Prajna Bhat
Prajna Bhat 2021 年 7 月 5 日
コメント済み: Shore 2023 年 2 月 11 日
The ThingSpeak API provides the possibility to embed the chart with historical values of a channel in a web page. Now I would also like to show the last value of a channel as a number on this page. I looked into some of the answers. But I could not understand. Can someone please share the JavaScript code OR the HTML code? I am new to ThingSpeak and Web Development.
Please help me out!!
Thank you,
Prajna Bhat
  1 件のコメント
Shore
Shore 2023 年 2 月 11 日
Vinod,
I am VERY impressed. Your advice worked so well. Thanks.

サインインしてコメントする。

採用された回答

Vinod
Vinod 2021 年 7 月 7 日
If you click the "bubble" icon on the numeric display widget added to your channel, you will get the HTML code required to embed the value on your HTML page. It should be of the form:
<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/<CHANNEL_ID>/widgets/<WIDGET_ID>"></iframe>
Where <CHANNEL_ID> and <WIDGET_ID> are to be replaced by those for your channel & widget. Note that you will need to make your channel public if you intend to embed the widget on your HTML page.
  4 件のコメント
Prajna Bhat
Prajna Bhat 2021 年 7 月 7 日
Thank you sooo much!
It works exactly as expected!!
Prajna Bhat
Prajna Bhat 2021 年 7 月 13 日
Hello Vinod,
Can you please let me know how I can store the current live value in a variable and access it in a loop or condition.
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeRead Data from Channel についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by