{"id":40364,"date":"2021-02-04T14:32:51","date_gmt":"2021-02-04T06:32:51","guid":{"rendered":"\/blog\/?p=40364"},"modified":"2021-03-04T09:56:40","modified_gmt":"2021-03-04T01:56:40","slug":"wio-terminal-arduino-customisable-timer-with-code","status":"publish","type":"post","link":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/","title":{"rendered":"Wio Terminal: Arduino Customisable Timer (with Code!)"},"content":{"rendered":"\n<p>In today\u2019s article, I will show you how you can transform your Wio Terminal or any Arduino Board with a TFT Display into a customisable kitchen timer!<\/p>\n\n\n\n<p>The Arduino code will be provided at the end, so you can download it as-is to use instantly with your Wio Terminal \/ Arduino. In addition, I will also be explaining the different sections of code, so that beginners can easily understand and adapt it for their needs!<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2021\/02\/Banner-copy-1-1030x559.jpg\" alt=\"\" class=\"wp-image-40493\"\/><\/figure>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Intro to the Kitchen Timer Project<\/strong><\/h2>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>You must be wondering &#8211; what\u2019s the point of a timer? Aren\u2019t kitchen timer\u2019s really affordable nowadays?<\/p>\n\n\n\n<p>Well, you\u2019re right! But this isn\u2019t any ordinary kitchen timer.<\/p>\n\n\n\n<p>Meet the \u201cMaggie Maker\u201d!<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/DKG5NGPV3xSL1vTCixCkayqODDTCefmTQyHXQwwEdkChSR9vUBTyzLJ7tWXbY-cTyEw_tvOWYjr7swsX0kCT5uewd_ETkBEQBSQMrtAU188lFkgHXhu35x_Q44g_kuwp1HqQnGp8\" alt=\"\" width=\"606\" height=\"403\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The Maggie Maker is a cookbook \/ timer all-in-one. By default, I\u2019ve programmed the timer to show you how to make a simple bowl of instant ramen with egg, hence the name (see <a href=\"https:\/\/en.wikipedia.org\/wiki\/Maggi#Noodles\">Wikipedia &#8211; Maggi<\/a>).<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Here are some features of the customisable timer:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Step-by-step instructions for cooking<\/li><li>Built in timer for instructions that are time-sensitive (like boiling that perfect egg!)<\/li><li>Toggle-able alarm setting from the main page<\/li><\/ul>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Follow today&#8217;s tutorial to you can have it working with any Wio Terminal or Arduino with a TFT LCD display in your possession &#8211; in no more than 5 minutes! Furthermore, you can customise this timer to display your favourite recipe &#8211; and I\u2019ll show you how right now.<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/6Z47vhsqj5J_aFbg9lqV60umOvafXdk4azOT_5Kkvgf7vz6FMFe1b9Lzm6sAwcg_G8oz44mjMobGEg1mXD4jfZTGoBEzLolMfyG2GXjskTtLg0EYOXdo2iWJ1D_21N6aoC0ptymO\" alt=\"\" width=\"606\" height=\"403\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How do I Use the Timer?<\/strong><\/h2>\n\n\n\n<div style=\"height:11px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Even if you have no experience with computer programming, you can simply use the code I\u2019ve written with ease. Just follow these steps!<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>If you\u2019re not using a Wio Terminal\u2026<\/strong><\/h3>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The code is written to work with LCD display resolutions of 320&#215;240, but is untested on platforms other than the Wio Terminal. If you have a display with a different size, you may have to tweak the drawings to make some elements display correctly.<\/p>\n\n\n\n<p>We will be using the Wio Terminal\u2019s built in button inputs to control the timer. If you are using another Arduino board, you will require a minimum of two additional buttons to take advantage of the full program functionality. You will also have to reconfigure the input pins in the setup() function of the Arduino code.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1.&nbsp; Download the Arduino IDE<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In order to program our Wio Terminal \/ Arduino board, we are going to use the comprehensive Arduino IDE. First choose the appropriate download for your operating system <a href=\"https:\/\/www.arduino.cc\/en\/software\/\">here<\/a>.<\/p>\n\n\n\n<p>Then, you can follow the following instructions to get installed: <a href=\"https:\/\/www.arduino.cc\/en\/Guide\/Windows\/\">Windows<\/a> \/ <a href=\"https:\/\/www.arduino.cc\/en\/Guide\/MacOSX\/\">Mac OSX<\/a> \/ <a href=\"https:\/\/www.arduino.cc\/en\/Guide\/Linux\/\">Linux<\/a><\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.&nbsp; Download Timer Code &amp; Install libraries<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Next, download the <a href=\"https:\/\/github.com\/supperted825\/wioterminal_maggiemaker\">timer code from GitHub<\/a> as a whole folder. We\u2019re going to need all the files in the repository to let the code work.<\/p>\n\n\n\n<p>If this is the first time you\u2019re using your Wio Terminal, visit the <a href=\"https:\/\/wiki.seeedstudio.com\/Wio-Terminal-Getting-Started\/\">Seeed Wiki page<\/a> to perform your initial set up.<\/p>\n\n\n\n<p>For other Arduino boards, visit <a href=\"https:\/\/www.arduino.cc\/en\/Guide\/\">Arduino\u2019s Getting Started page<\/a>, and select your board from the scrollable navigation panel on the right for your instructions.<\/p>\n\n\n\n<p>Once that\u2019s done, we\u2019re going to install the <a href=\"https:\/\/github.com\/Bodmer\/TFT_eSPI\">TFT_eSPI graphics library<\/a>. This is what allows things to be drawn onto our LCD display.<\/p>\n\n\n\n<p>To install the library, open the <a href=\"https:\/\/www.arduino.cc\/en\/Guide\/Libraries\/\">library manager<\/a> in the Arduino IDE and search for \u201ctft_eSPI\u201d. Install the library.<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/-QdjrghR-hpdp5zPPTPw1Hjgitj9mJ-GZxj84gU-YiALF8r81UV44JG36LphfBlb9o0oP_8nBKR_TvXNm5e6VcuMPQCa2gRYxEUAw3oXlwSZ3fyh6EzAUmVlc5jjdcj9nQrbjGif\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.&nbsp; Customise Timer Code<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Now\u2019s the fun part. Open the MaggieMaker.ino file and scroll all the way to the bottom.<\/p>\n\n\n\n<p>You should see the loop() function shown below (or some variation of it).<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2021\/02\/Book-Code-1-1030x191.png\" alt=\"\" class=\"wp-image-40526\" width=\"856\" height=\"158\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/Book-Code-1-1030x191.png 1030w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/Book-Code-1-300x56.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/Book-Code-1-768x143.png 768w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/Book-Code-1-1024x190.png 1024w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/Book-Code-1.png 1108w\" sizes=\"(max-width: 856px) 100vw, 856px\" \/><\/figure><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>You can think of this as a digitalised cookbook. We first have a cover() function, which takes in 0 for the front cover and 1 for the rear.<\/p>\n\n\n\n<p>The front cover() is customisable with two additional String inputs. For example, if you wanted to have it show \u201cHow to make pancakes\u201d, you would write:<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>cover(0, \u201cHow To\u201d, \u201cMake Pancakes\u201d);<\/code><\/pre>\n\n\n\n<p>Following this, we have where the magic happens &#8211; the page(). The page() function takes in a few parameters in this order:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Step Number<\/strong> &#8211; Displays the step number of the current page.<\/li><li><strong>Title<\/strong> &#8211; This is the main instruction for the page.<\/li><li><strong>Duration<\/strong> &#8211; How long should the timer for this step run for? Enter 0 if no timer is required (eg. preparing or adding ingredients).<\/li><li><strong>Notes1<\/strong> &#8211; First line of notes. Describe the step or accompanying instructions.<\/li><li><strong>Notes2<\/strong> &#8211; Second line of notes. Optional input<\/li><li><strong>Notes3<\/strong> &#8211; Third line of notes. Optional input.<\/li><\/ol>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The best thing is that you can add as many pages as you want, so you can really turn this into any kind of cookbook. Have fun with it!<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.&nbsp; Flash to Wio Terminal<\/strong> \/ Arduino<\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Once you\u2019re done customising your recipe, we will have to flash it to our Wio Terminal or Arduino board by clicking the arrow button next to the check mark in the Arduino IDE.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/yYI0yyul3PZI92lwvf5HGFfZCYWZHj4Oot6FKUMhUARnX_EXhs6c9TZAdKXcJzeLc902cTowFRx3S4FTBu9sHfhLDVFwKz1xbw8kCy1tTEQxQqKT9bT8S1bBxU1eAUl89U_Hwb-a\" alt=\"\" width=\"639\" height=\"168\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>For more information, please refer to Step 5 on <a href=\"https:\/\/wiki.seeedstudio.com\/Wio-Terminal-Getting-Started\/\">this page<\/a>. These instructions will apply to all Arduino boards as well.<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>If you encounter an error, take a look at what the console says (that\u2019s the black window at the bottom):<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If you see \u201cinvalid conversion\u201d &#8230;<\/strong><\/h4>\n\n\n\n<p>This means that you\u2019ve input the wrong type in the wrong place. Remember that page() takes in 4 compulsory and 2 optional inputs in a specific order! Text inputs should be encapsulated by a \u201c&#8230;\u201d, whereas number inputs can be typed plainly.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If you see \u201cexpected \u2018;\u2019 before\u201d &#8230;<\/strong><\/h4>\n\n\n\n<p>This means that you\u2019ve missed out a semicolon! The semicolon or \u2018;\u2019 character denotes the end of the line. The IDE should highlight the line that this problem is associated with, so the missing semicolon should be easy to find.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If your code was uploaded successfully but the LCD display is blank &#8230;<\/strong><\/h4>\n\n\n\n<p>This can mean that there is a conflict in the TFT_eSPI library that you have installed. To fix the issue, head over to your Arduino\/Libraries folder and delete the TFT_eSPI library folder there. Reupload your code and the display should work now!<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>From this point on, we\u2019re going to get into the implementation! <\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Platform Introduction: Wio Terminal<\/strong><\/h2>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>If you\u2019ve gotten this far without a Wio Terminal, kudos to you! Because Arduino boards come relatively barebones with no peripherals other than their GPIO pins, you would\u2019ve had to figure out most, if not all, of the hardware configurations.<\/p>\n\n\n\n<p>For this reason, I\u2019ve chosen the Wio Terminal for this project. The Wio Terminal is a fully integrated microcontroller development platform that supports Arduino and MicroPython. It carries Bluetooth, Wi-Fi connectivity, and comes with an LCD screen, onboard IMU, microphone, buzzer, light sensor and infrared emitter.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/sbSpoVZpEoOHOj43sT-bQnzWPRukgsM4Y59VAHKbIkjiU-gMDwSV2G-k3xGfEwDtcRM5wQ9F5P4bH6s0_-nQfyFN8h3i_uVNkpbLQ-6_4UUEAh56bTArF7JJHbKNpLOcrSvYhCmV\" alt=\"\" width=\"630\" height=\"364\"\/><\/figure><\/div>\n\n\n\n<p>All I have to do is plug in a common USB Type-C cable, and I can begin writing my code. Not to mention, if I combine it with its <a href=\"https:\/\/www.seeedstudio.com\/Wio-Terminal-Chassis-Battery-650mAh-p-4756.html\">battery chassis<\/a>, I&#8217;d already have a mobile kitchen timer form factor &#8211; exactly what I needed!<\/p>\n\n\n\n<p>You can pick up a Wio Terminal from the <a href=\"https:\/\/www.seeedstudio.com\/Wio-Terminal-p-4509.html\">Seeed Online Store<\/a>.<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Cookbook Program Schematic<\/strong><\/h2>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In this section, I will break down the Arduino code used in the programming. If you haven&#8217;t downloaded the project code, you can do so <a href=\"https:\/\/github.com\/supperted825\/wioterminal_maggiemaker\">here<\/a>.<\/p>\n\n\n\n<p>You\u2019ll be able to learn how the code supports the timer\u2019s features &#8211; so you can easily make adjustments for your own uses!<\/p>\n\n\n\n<p>However, I won\u2019t be covering the library syntax, so feel free to refer to the following links for their documentation as we go along. You\u2019ll ideally also want to have the full Arduino code by your side, so you know what fits where!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/Bodmer\/TFT_eSPI\/blob\/master\/TFT_eSPI.h\">TFT_eSPI Graphics Library Documentation<\/a><\/li><li><a href=\"https:\/\/github.com\/Bodmer\/TFT_eSPI\/blob\/master\/Extensions\/Sprite.h\">TFT_eSPI Sprite Class Documentation<\/a><\/li><\/ul>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>There are 2 main \u2018modules\u2019 to the entire Arduino program &#8211; the cover() and the page().<\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Cover()<\/strong><\/h3>\n\n\n\n<p>The cover() function serves two simple purposes &#8211; to display the cover text and to allow for the alarm sound to be toggled.<\/p>\n\n\n\n<p>First, we display the text, then enter a while loop that continues when the clicker_state is 0. In this loop, there are multiple \u201cif\u201d statements. Essentially, we are asking the program to continuously check if these buttons are being pressed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while (clicker_state == 0) {\n    \/\/ &lt;&lt;ALARM TOGGLE CODE&gt;&gt;\n    if (digitalRead(WIO_KEY_C) == LOW) {\n        \/\/ TOGGLE ALARM\n    }\n    \/\/ BREAK OUT OF LOOP IF BUTTON IS PRESSED\n    if (digitalRead(WIO_5S_PRESS) == LOW) {\n        clicker_state = 1;\n        delay(500);\n        alarm_text.deleteSprite();\n    }\n}<\/code><\/pre>\n\n\n\n<p>The first condition will toggle between alarm_state 0 and 1, displaying the audio indicator accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ &lt;&lt; ALARM TOGGLE CODE&gt;&gt;\nif (digitalRead(WIO_KEY_C) == LOW) {\n    if (alarm_state == 1) {\n        alarm_state = 0;\n        tft.fillRect(300, 0, 50, 50, TFT_BLACK);\n        delay(500);\n    } else if (alarm_state == 0) {\n        alarm_state = 1;\n        alarm_logo();\n        delay(500);\n    }\n}<\/code><\/pre>\n\n\n\n<p>The second condition is waiting for the main button to be pressed, which will set the clicker_state to 1. This will exit the loop and the function ends. The program automatically moves into the following function, which is usually a page().<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Page()<\/strong><\/h3>\n\n\n\n<p>The page() function is just slightly more complicated. First, take a look at the schematic.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/H97EgRj3WnSWju_pqs670cleCpRdo9wwOkc4Hi_BB8Utl_JN77cgpmP473FzAuJxQ06DIUyyIGsxzBfaggDs7v2dfdxP-cZpnYmD1PITcnWaYJvpBSYO1LLMAUML0xxvv2MezQfO\" alt=\"\" width=\"998\" height=\"582\"\/><\/figure><\/div>\n\n\n\n<p>When page() is called, it immediately creates the sprites for the text to be displayed on the page, then pushes them to be displayed on the LCD. Then, we enter a loop where we await input from the user before proceeding.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If duration is not 0 \u2026<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>A non-zero duration means that the user wants to engage the timer at this point for the length of &lt;duration&gt; seconds. I created the timer with reference to this <a href=\"https:\/\/www.hackster.io\/SeeedStudio\/wio-terminal-timer-6afe8c\">Wio Terminal Timer by Seeed on Hackster<\/a>.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"338\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2021\/02\/ezgif.com-video-to-gif-2.gif\" alt=\"\" class=\"wp-image-40565\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Let\u2019s break down the timer code in detail, since it can be a little overwhelming at first glance.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>long start_millis = millis();\nint progress, t_min, t_sec;\nlong seconds_elapsed = 0;\nlong seconds_remain;\n\n<code>while(seconds_elapsed&lt;duration &amp;&amp; clicker_state == 0) {<\/code>\n<code>    seconds_elapsed = (millis() - start_millis)\/1000;<\/code>\n<code>    seconds_remain = duration - seconds_elapsed;<\/code>\n<code>    t_min = seconds_remain\/60;<\/code>\n    <code>t_sec = seconds_remain%60;<\/code>\n    \n    \n    <code>ttext.setCursor(0, 0);<\/code>\n    <code>ttext.setTextColor(0xFFE0, 0);<\/code>\n<code>    ttext.setTextSize(3);<\/code>\n<code>    ttext.printf(\"%02d:%02d\", t_min, t_sec);<\/code>\n<code>    ttext.pushSprite(220,200);<\/code>\n\n    <code>progress = 200*seconds_elapsed\/duration;<\/code>\n    <code>tft.fillRoundRect(10, 210, progress, 10, 4, TFT_WHITE);<\/code>\n\n    <code>if (digitalRead(WIO_5S_PRESS) == LOW) {<\/code>\n        <code>clicker_state = 1;<\/code>\n        <code>skipped_timer = true;<\/code>\n<code>    }<\/code>\n<code>}<\/code>\n<code>clicker_state = 0;<\/code><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Keeping Time:<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Check and record the runtime with millis() before starting the timer and display the empty progress bar.<\/li><li>Create a while loop to keep checking the time passed, by taking the difference between a new millis() call and the original marked timing.<\/li><li>Timer stops if clicker_state is 1 or if the timer duration has been completed.<\/li><\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code><code>while(seconds_elapsed&lt;duration &amp;&amp; clicker_state == 0) {<\/code>\n<code>    seconds_elapsed = (millis() - start_millis)\/1000;<\/code>\n<code>    seconds_remain = duration - seconds_elapsed;<\/code>\n\n    <code>if (digitalRead(WIO_5S_PRESS) == LOW) {<\/code>\n        <code>clicker_state = 1;<\/code>\n        <code>skipped_timer = true;<\/code>\n<code>    }<\/code>\n<code>}<\/code>\n<code>clicker_state = 0;<\/code><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Displaying Progress:<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Display remaining minutes \/ seconds by taking the quotient \/ remainder of the number of seconds remaining divided by 60 respectively.<\/li><li>Take the proportion of time completed (time elapsed \/ duration) as the progress bar length \/ total length. With each loop, redraw a progress bar with the new length to make the bar \u201cmove\u201d<\/li><\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code><code>t_min = seconds_remain\/60;<\/code>\n<code>t_sec = seconds_remain%60;<\/code>\n    \n<code>ttext.setCursor(0, 0);<\/code>\n<code>ttext.setTextColor(0xFFE0, 0);<\/code>\n<code>ttext.setTextSize(3);<\/code>\n<code>ttext.printf(\"%02d:%02d\", t_min, t_sec);<\/code>\n<code>ttext.pushSprite(220,200);<\/code>\n\n<code>progress = 200*seconds_elapsed\/duration;<\/code>\n<code>tft.fillRoundRect(10, 210, progress, 10, 4, TFT_WHITE);<\/code><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Skipping the Timer:<\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Conditional statement: If clicker is pressed, assign clicker_state a value of 1 to break out of the while loop on the next iteration.<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code><code>if (digitalRead(WIO_5S_PRESS) == LOW) {<\/code>\n    <code>clicker_state = 1;<\/code>\n    <code>skipped_timer = true;<\/code>\n<code>}<\/code><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Ringing the Alarm:<\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The alarm rings after the time runs out and if alarm_state equals 1. On the other hand, if the timer was interrupted or if alarm_state is 0, the alarm will be skipped.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (skipped_timer == false &amp;&amp; alarm_state == 1) {\n    alarm();\n} else if (skipped_timer == false &amp;&amp; alarm_state == 0) {\n    delay(2000);\n} else {\n    skipped_timer = false;\n    delay(500);\n}<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Finally, A complete page is shown to prompt the user before proceeding to the next step, where the wait for input is implemented with a similar while loop.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If duration is 0 &#8230;<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>A different version of the complete page is simply shown, and the user can click to proceed once they are ready.<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Arduino Code: Things to Note<\/strong><\/h2>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using the Graphics Library (Drawing, Updating, Erasing)<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>If you are new to programming LCD displays, I\u2019d recommend you to visit this short <a href=\"https:\/\/wiki.seeedstudio.com\/Wio-Terminal-LCD-Basic\/\">5-minute read on the Seeed Wiki<\/a> to understand the underlying concepts.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>LCD &amp; Sprites<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>With TFT_eSPI, you can draw directly onto the screen by calling the functions on the LCD class that you\u2019ve defined. However, if you want to draw objects with different text sizes or colours, you will have to specify each parameter with a line in your code. Also, if you want to display multiple copies of the same object, you\u2019ll have to duplicate your lines of code, making it rather messy.<\/p>\n\n\n\n<p>This is where sprites come in. You can think of sprites as secondary displays that are stored in RAM.<\/p>\n\n\n\n<p>Sprites can be written once and pushed multiple times to the LCD &#8211; you simply have to define the coordinates for each push. Each sprite will also keep their own defined parameters in memory, so we can avoid the trouble of respecifying our formatting when trying to push multiple sprites consecutively.<\/p>\n\n\n\n<p>If, however, you want to push a different text on the same sprite, you\u2019ll have to call the deleteSprite() function and redraw your sprite from scratch! Else, you may find your new text does not display as desired.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Erasing Screen Content<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>When working with LCD screens on microcontrollers like Wio Terminal or Arduino boards, you\u2019ll never see the use of an erase function. Instead, we\u2019ll use the sorcery known as covering up our displayed objects with the background colour!<\/p>\n\n\n\n<p>For example, if we want to erase our entire screen that has a background colour of black, we can use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TFT.fillScreen(TFT_BLACK);<\/code><\/pre>\n\n\n\n<p>Alternatively, we can also draw black, filled rectangles to erase certain sections of our screen, like what I\u2019ve done to erase the timer portion at the bottom of the screen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TFT.fillRect(0, 200, 400, 40, TFT_BLACK);<\/code><\/pre>\n\n\n\n<p>If you are working with complex sprites and can\u2019t afford to erase by the rectangle-load, simply create a copy of the existing lines of code you already have and change the colour of the elements to your background colour.<\/p>\n\n\n\n<p>For example, the alarm icon is drawn with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void alarm_logo() {\n    sp.createSprite(12,13);\n    sp.fillTriangle(5,0,5,13,0,6,0xFFFF);\n    sp.fillRect(0,4,2,5,0xFFFF);\n    sp.drawFastVLine(8,5,3,0xFFFF);\n    sp.drawFastVLine(11,5,3,0xFFFF);\n    sp.drawFastVLine(10,3,2,0xFFFF);\n    sp.drawFastVLine(10,8,2,0xFFFF);\n    sp.drawLine(8,1,10,3,0xFFFF);\n    sp.drawLine(8,11,10,9,0xFFFF);\n    sp.drawPixel(7,4,0xFFFF);\n    sp.drawPixel(7,8,0xFFFF);\n    sp.pushSprite(300, 5);\n}<\/code><\/pre>\n\n\n\n<p>To erase it, you can create a counterpart erase_alarm_logo() function with all the components drawn in black, then push it to the same coordinates. The black will overwrite our old sprite on those exact pixels, erasing it neatly!<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Non-Blocking Delays &amp; States<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>One concept I find really worth sharing is the concept of non-blocking delays &amp; state.<\/p>\n\n\n\n<p>We\u2019ve used a lot of while loops in this program, but take note that none of these use the delay() function, at least in the main loop!<\/p>\n\n\n\n<p>Use of delays within loops in microcontroller programming should generally be avoided, especially if we want to \u201cwait\u201d for user input within that loop.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>The Problem: Delays<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Let\u2019s say we want to flash an LED every second until a user presses a button. We might write the code as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while ( digitalRead(BUTTON_PIN) == LOW ) {\n digitalWrite(LED_PIN, HIGH);\n delay(1000);\n digitalWrite(LED_PIN, LOW);\n delay(1000);\n}<\/code><\/pre>\n\n\n\n<p>Do you see the problem? The \u2018button pressed\u2019 condition is only checked for at the beginning of each loop!<\/p>\n\n\n\n<p>Typically, the code in the loop runs so fast that it doesn\u2019t matter. Even if the user pressed the button right after the condition was just checked, the check would quickly come up again as the loop resets &#8211; usually occurring even before the button is released!<\/p>\n\n\n\n<p>With delays, that\u2019s only a split second every 2 seconds that the condition is checked! It\u2019s nearly impossible to break out of this loop now.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>The Solution: Millis() and State<\/strong><\/h4>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>To avoid the use of delays, we will use the millis() function to keep track of our time. We will also use the LED_on variable to keep track of the LED\u2019s current state.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>long currTime = millis();\nint LED_on = 0;<\/code><\/pre>\n\n\n\n<p>Then, we enter our while loop.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>while (button_state == 0) {\n    if ( (millis() - currTime) &gt; 1000 ) {\n        currTime = millis();\n        if (LED_on == 0) {\n            LED_on = 1;\n            digitalWrite(LED_PIN, HIGH);\n        } else {\n            LED_on = 0;\n            digitalWrite(LED_PIN, LOW);\n        }\n    }\n    if (digitalRead(BUTTON_PIN) == HIGH) button_state = 1;\n}<\/code><\/pre>\n\n\n\n<p>When one second has passed, we reset the marker to the current millis() output. If the LED is currently turned off, we\u2019ll turn it on and mark the LED_on state to 1. That way, when the condition is triggered again after 1 second, the LED will be turned off instead.<\/p>\n\n\n\n<p>Now, we no longer have delays in our loop, and you\u2019ll find that this works much more consistently as intended! If you want to read more about non blocking delays and states, I highly recommend you visit <a href=\"https:\/\/forum.arduino.cc\/index.php?topic=223286.0\">this page<\/a> on the Arduino Forums.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Other Graphics Libraries<\/strong><\/h3>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The graphics libraries are powerful resources for display graphics on our LCD screens. For this project, I used the TFT_eSPI library, but you can also use <a href=\"https:\/\/wiki.seeedstudio.com\/Wio-Terminal-LVGL\/\">LVGL<\/a> or <a href=\"https:\/\/github.com\/lovyan03\/LovyanGFX\">LovyanGFX<\/a>. Depending on what you want to draw, you may find some of them better suited for your own projects!<\/p>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>Phew! Today we\u2019ve looked at the kitchen timer project and how you can use it on your Wio Terminal or Arduino board with LCD display. In addition, I\u2019ve shown you how to customize it without much programming.<\/p>\n\n\n\n<p>We\u2019ve also gone in depth and dissected the program structure and Arduino code, so you can easily change the behaviour of the timer or adapt it for your other programmes!<\/p>\n\n\n\n<p>I hope this tutorial has been helpful for you, and I encourage you to pick up a project of your own &#8211; it\u2019s truly the best way to learn!<\/p>\n\n\n\n<p>For more Arduino or Wio Terminal examples, <a href=\"https:\/\/github.com\/Seeed-Studio\/Seeed_Arduino_Sketchbook\/tree\/master\/examples\">click here<\/a>.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In today\u2019s article, I will show you how you can transform your Wio Terminal or<\/p>\n","protected":false},"author":3537,"featured_media":41174,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[6,3044,3043,3003,3678],"class_list":["post-40364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-arduino","tag-arduino-tft","tag-tft-lcd","tag-wio-terminal","tag-wio-terminal-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio<\/title>\n<meta name=\"description\" content=\"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio\" \/>\n<meta property=\"og:description\" content=\"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Latest News from Seeed Studio\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-04T06:32:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-04T01:56:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3000\" \/>\n\t<meta property=\"og:image:height\" content=\"1750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jonathan Tan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan Tan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/\",\"name\":\"Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio\",\"isPartOf\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png\",\"datePublished\":\"2021-02-04T06:32:51+00:00\",\"dateModified\":\"2021-03-04T01:56:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/61e29862da8741ee517eacd92f4cd094\"},\"description\":\"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png\",\"contentUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png\",\"width\":3000,\"height\":1750},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.seeedstudio.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Wio Terminal: Arduino Customisable Timer (with Code!)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/\",\"name\":\"Latest News from Seeed Studio\",\"description\":\"Emerging IoT, AI and Autonomous Applications on the Edge\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/61e29862da8741ee517eacd92f4cd094\",\"name\":\"Jonathan Tan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d8dd1a4a7882386e8818e110c9322897?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d8dd1a4a7882386e8818e110c9322897?s=96&r=g\",\"caption\":\"Jonathan Tan\"},\"url\":\"https:\/\/www.seeedstudio.com\/blog\/author\/jonathan-tan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio","description":"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/","og_locale":"en_US","og_type":"article","og_title":"Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio","og_description":"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!","og_url":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/","og_site_name":"Latest News from Seeed Studio","article_published_time":"2021-02-04T06:32:51+00:00","article_modified_time":"2021-03-04T01:56:40+00:00","og_image":[{"width":3000,"height":1750,"url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png","type":"image\/png"}],"author":"Jonathan Tan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathan Tan","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/","url":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/","name":"Wio Terminal: Arduino Customisable Timer (with Code!) - Latest News from Seeed Studio","isPartOf":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage"},"image":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png","datePublished":"2021-02-04T06:32:51+00:00","dateModified":"2021-03-04T01:56:40+00:00","author":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/61e29862da8741ee517eacd92f4cd094"},"description":"Learn how to turn your Wio Terminal or Arduino board with LCD display into a customisable timer with this step-by-step guide, with code provided!","breadcrumb":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#primaryimage","url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png","contentUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png","width":3000,"height":1750},{"@type":"BreadcrumbList","@id":"https:\/\/www.seeedstudio.com\/blog\/2021\/02\/04\/wio-terminal-arduino-customisable-timer-with-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.seeedstudio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Wio Terminal: Arduino Customisable Timer (with Code!)"}]},{"@type":"WebSite","@id":"https:\/\/www.seeedstudio.com\/blog\/#website","url":"https:\/\/www.seeedstudio.com\/blog\/","name":"Latest News from Seeed Studio","description":"Emerging IoT, AI and Autonomous Applications on the Edge","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/61e29862da8741ee517eacd92f4cd094","name":"Jonathan Tan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d8dd1a4a7882386e8818e110c9322897?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8dd1a4a7882386e8818e110c9322897?s=96&r=g","caption":"Jonathan Tan"},"url":"https:\/\/www.seeedstudio.com\/blog\/author\/jonathan-tan\/"}]}},"modified_by":"Jonathan Tan","views":4859,"featured_image_urls":{"full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png",3000,1750,false],"thumbnail":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-80x80.png",80,80,true],"medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-300x175.png",300,175,true],"medium_large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-768x448.png",640,373,true],"large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-1030x601.png",640,373,true],"1536x1536":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-1536x896.png",1536,896,true],"2048x2048":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-2048x1195.png",2048,1195,true],"visody_icon":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25.png",32,19,false],"magazine-7-slider-full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-1536x1020.png",1536,1020,true],"magazine-7-slider-center":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-936x897.png",936,897,true],"magazine-7-featured":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-1024x597.png",1024,597,true],"magazine-7-medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-720x380.png",720,380,true],"magazine-7-medium-square":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2021\/02\/25-675x450.png",675,450,true]},"author_info":{"display_name":"Jonathan Tan","author_link":"https:\/\/www.seeedstudio.com\/blog\/author\/jonathan-tan\/"},"category_info":"<a href=\"https:\/\/www.seeedstudio.com\/blog\/category\/news\/\" rel=\"category tag\">News<\/a>","tag_info":"News","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/40364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/users\/3537"}],"replies":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/comments?post=40364"}],"version-history":[{"count":57,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/40364\/revisions"}],"predecessor-version":[{"id":41175,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/40364\/revisions\/41175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media\/41174"}],"wp:attachment":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media?parent=40364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/categories?post=40364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/tags?post=40364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}