在本教程中,我们将学习如何使用 TTGO ESP32 和 Visuino 获得美元和欧元的当前比特币价格。
Visuino:需要安装https://www.visuino.eu 。启动Visuino,如第一图所示点击Visuino中Arduino组件(图1)上的“工具”按钮出现对话框时,选择“TTGO T-Display ESP32”,如图2所示
选择 TTGO T-Display ESP32 board 并在属性窗口中展开“Modules>WiFi>Connect To Access Points
单击连接到接入点 3 点
选择 TTGO T-Display ESP32 board 并在属性窗口中展开“Modules>WiFi>Sockets
单击 Sockets3 Dots 在 Sockets 窗口中将 TCP/IP Secure Client (SSL) 拖到左侧
选择 TTGO T-Display ESP32 board 并在属性窗口中展开“Modules>Display>Orientation
将方向设置为:goRight
选择 TTGO T-Display ESP32 board 并在属性窗口中展开“Modules>Display>Elements
单击元素 3 点
在 Elements 窗口中,将 Draw Bitmap 拖到左侧
在属性窗口中将 Y 设置为 20,单击位图 3 Dots
在位图编辑器中加载比特币位图(图 6)并关闭位图编辑器
在 Elements 窗口中,将 Draw Text 拖到左侧
在属性窗口中将颜色设置为 aclOrange,大小设置为 2,文本设置为 USD,X 设置为 150,Y 设置为 10
在 Elements 窗口中,将 Text Field 拖到左侧
在属性窗口中设置 size 为 3,X 为 100,Y 为 35
在 Elements 窗口中,将 Draw Text 拖到左侧
在属性窗口中将颜色设置为 aclOrange,大小设置为 2,文本设置为 EUR,X 设置为 150,Y 设置为 80
在 Elements 窗口中将 Text Field 拖到左侧在属性窗口中设置 size 为 3,X 为 100,Y 为 105
关闭元素窗口
选择并在属性窗口中将 Host 设置为 api.coindesk.com 点击 Requests 3 Dots
{"time":{"updated":"Sep 18, 2013 17:27:00 UTC","updatedISO":"2013-09-18T17:27:00+00:00"},"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index. Non-USD currency data converted using hourly conversion rate from openexchangerates.org","bpi":{"USD":{"code":"USD","symbol":"$","rate":"126.5235","description":"United States Dollar","rate_float":126.5235},"GBP":{"code":"GBP","symbol":"£","rate":"79.2495","description":"British Pound Sterling","rate_float":79.2495},"EUR":{"code":"EUR","symbol":"€","rate":"94.7398","description":"Euro","rate_float":94.7398}}}
Note: you can also play with the other pins from "SplitJSON1" component
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
If you power the TTGO ESP32 module it will connect to the network and display the current Bitcoin price in USD and EUR
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.eu
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !