{"id":6496,"date":"2022-01-12T10:30:06","date_gmt":"2022-01-12T10:30:06","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=6496"},"modified":"2024-09-30T16:41:32","modified_gmt":"2024-09-30T11:11:32","slug":"led-control-mealy-machine-example","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/","title":{"rendered":"FSM Lecture 4- Exercise-001 LED control Mealy machine example"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 50px;\"><span style=\"color: #000080;\"><strong>Exercise &#8211; LED control Mealy machine example<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Light control Mealy machine implementation:<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this exercise, we will implement the Light control Mealy machine.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For this exercise, you need a<\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/fastbitembedded.com\/products\/arduino-uno-r3-smd-atmega328-compatible-board\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400; color: #000000;\">Arduino Uno board<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">1, <a href=\"https:\/\/fastbitembedded.com\/collections\/leds\" target=\"_blank\" rel=\"noopener\">5mm LED<\/a><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/fastbitembedded.com\/collections\/jumper-wires\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400; color: #000000;\">Jumper wires<\/span><\/a><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6515\" aria-describedby=\"caption-attachment-6515\" style=\"width: 871px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-6515 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/requirements-1.png\" alt=\"LED control Mealy machine example\" width=\"871\" height=\"287\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1.png 871w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-300x99.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-768x253.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-600x198.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-120x40.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-500x165.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-200x66.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-400x132.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/requirements-1-800x264.png 800w\" sizes=\"(max-width: 871px) 100vw, 871px\" \/><figcaption id=\"caption-attachment-6515\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Requirements<\/span><\/figcaption><\/figure>\n<div class=\"mceTemp\"><\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this article, you learn about the Arduino board, its peripherals, and its programming interfaces, and some of the APIs used to control the peripherals, etc., and know the APIs provided by the Arduino community to do various things.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 40px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Arduino Uno Board:<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">The Arduino Uno board has many pins and a couple of holes(figure 2). <span class=\"TextRun SCXW93063140 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW93063140 BCX0\">Those holes are connected to the microcontroller, which is there on the Arduino Uno boards.<\/span><\/span><span class=\"EOP SCXW93063140 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">&nbsp;<\/span><\/span><\/span><\/p>\n<figure id=\"attachment_6503\" aria-describedby=\"caption-attachment-6503\" style=\"width: 609px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6503\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/sample.png\" alt=\"LED control Mealy machine example\" width=\"609\" height=\"343\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/sample-1200x675.png 1200w\" sizes=\"(max-width: 609px) 100vw, 609px\" \/><figcaption id=\"caption-attachment-6503\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Arduino board<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Digital pins:<\/span><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">0 to 13 are digital pins. Total 14 digital pins.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">A few pins are PWM pins in the digital pins, which are marked with the symbol tild(~).<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Arduino PWM pins:<\/span><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Uno : 3, 5, 6, 9, 10, 11 are PWM pins<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">On these pins Arduino uno can generate PWM signals<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">PWM signal frequency :<\/span>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">490Hz on 3,9,10,11<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">980Hz on 5 and 6<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Analog pins:<\/span><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">A0 to A5 are analog pins. Six analog pins.&nbsp;<\/span><\/li>\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">Suppose you have any analog sensors or are doing some projects related to the analog to digital converter or digital to analog converter. In that case, you can use analog peripherals at analog pins.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">ATmega328P Microcontroller:<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">It is an 8-bit microcontroller from Atmel.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 25px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #800080;\"><span style=\"font-weight: 400;\">Example:<\/span><\/span><\/p>\n<figure id=\"attachment_6505\" aria-describedby=\"caption-attachment-6505\" style=\"width: 1280px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6505 size-full\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/duty-cycle-0.png\" alt=\"LED control Mealy machine example, ATmega328P Microcontroller\" width=\"1280\" height=\"720\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-0-1200x675.png 1200w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><figcaption id=\"caption-attachment-6505\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. PWM 0% duty cycle<\/span><\/figcaption><\/figure>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">When you supply 0 to the analogWrite(), that is to say, 0% duty cycle. That means the signal is always at 0 volts, which means it\u2019s 0 volts. (Figure 3)<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6506\" aria-describedby=\"caption-attachment-6506\" style=\"width: 1920px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6506 size-full\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/duty-cycle-25.png\" alt=\"LED control Mealy machine example, ATmega328P Microcontroller\" width=\"1920\" height=\"1080\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25.png 1920w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/duty-cycle-25-1200x675.png 1200w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><figcaption id=\"caption-attachment-6506\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. PWM 25% duty cycle<\/span><\/figcaption><\/figure>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"color: #000000;\">When you want to create a PWM wave with a 25% duty cycle, that means 25% of the time it will be &#8216;ON&#8217; and 75% of the time it will be &#8216;OFF.&#8217; And its time period is 1\/490 because the frequency is 490Hz. That comes around two milliseconds. 2 milliseconds is the time period of the PWM wave. And out of that 2 milliseconds, 25% of the time it will be &#8216;ON&#8217;, that means, the signal will be 5 volt and the rest of the time it will be 0 volts. (Figure 4)<\/span><\/li>\n<li><span style=\"color: #000000;\">If you take the average voltage, it comes around 25% of 5 volts. That is an average voltage. And that much voltage is fed to the LED.<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 28px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 37px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><span style=\"font-weight: 400;\">Changing intensity of an LED<\/span><\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Connect the LED to any of the PWM pins<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Change the duty cycle of the PWM wave using the Arduino API analogWrite()<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Use the Arduino serial interface to send ON, OFF events from HOST<\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">For this exercise, we need two buttons. One button sends the \u2018ON\u2019 event, and another sends the \u2018OFF\u2019 event. Instead of using the buttons, we will send \u2018ON\u2019 and \u2018OFF\u2019 commands or events through the Arduino serial interface. We will send the commands from HOST.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6508\" aria-describedby=\"caption-attachment-6508\" style=\"width: 680px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6508 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png\" alt=\"Figure 5. Arduino serial(UART) communication with HOST, ATmega328P Microcontroller\" width=\"680\" height=\"383\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST-1200x675.png 1200w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><figcaption id=\"caption-attachment-6508\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Arduino serial(UART) communication with HOST<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Figure 5 shows the Arduino serial communication with HOST. It shows the Host(our computer) and the target(Arduino board). We can do serial communication between the USB cable.<\/span><br \/>\n<span style=\"color: #000000;\">When you connect the board to the computer through the USB cable, a virtual COM port is created in the Host.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 26px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 40px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><span style=\"font-weight: 400;\">analogWrite()<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">The analogWrite() function generates the PWM wave with the desired duty cycle.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">&nbsp;<\/span><strong><span style=\"text-decoration: underline; color: #800080;\">Description<\/span><\/strong><\/span><\/p>\n<p class=\"\" style=\"padding-left: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">It writes an analog value to a pin. It can be used to light a LED at varying brightness or drive a motor at various speeds. This function generates a steady rectangular wave of this specified duty cycle until the next call to analogWrite() or digital functions.<\/span><\/p>\n<blockquote>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"color: #800080;\"><strong>Note:<\/strong>&nbsp;<\/span>On Arduino Uno, the function analogWrite() has nothing to do with the internal analog peripheral, like ADC. Because the Arduino Uno doesn&#8217;t have the DAC peripheral. DAC peripheral it doesn&#8217;t have.<\/span><\/p>\n<\/blockquote>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">In some other boards, in addition to the PWM capabilities on the pins, the MKR, Nano 33 IoT, and Zero boards have true analog output when using analogWrite() on the DAC pin. But it is not the case with the Uno board.<\/span><\/li>\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">And the Due also has a true analog output. True analog output means using the internal DAC peripheral.<\/span><\/li>\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">For Uno, you know, this function produces a rectangular wave of desired duty cycle.<\/span><\/li>\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">You do not need to call pinmode() to set the pin as an output before calling analogWrite().<\/span><\/li>\n<li><span style=\"color: #000000;\" data-preserver-spaces=\"true\">The analogWrite function has nothing to do with the analog pins or the analogRead function.&nbsp;<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"text-decoration: underline;\"><span style=\"color: #800080; text-decoration: underline;\">Syntax:<\/span><\/span><\/strong><\/p>\n<p class=\"\" style=\"padding-left: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #993366;\">analogWrite(pin, value)<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"text-decoration: underline;\"><span style=\"color: #800080; text-decoration: underline;\">Parameter:<\/span><\/span><\/strong><\/p>\n<p class=\"\" style=\"padding-left: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">It has two parameters: pin and value.<\/span><br \/>\n<span style=\"color: #000000;\"><span style=\"text-decoration: underline;\">Pin number:<\/span> A PWM pin number you should mention. Allowed data types: int.<\/span><br \/>\n<span style=\"color: #000000;\"><span style=\"text-decoration: underline;\">Value:<\/span> It controls the duty cycle: Between 0(always OFF) and 255(always ON). 0 means, 0% duty cycle; 255 means, 100% duty cycle; and any in between numbers you can use to achieve different duty cycles of the PWM wave. It has allowed data types: int.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 40px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><span style=\"font-weight: 400;\">analogRead()<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The analogRead() functions use the ADC peripheral because the analogRead() function converts the applied input voltage to a digital number.<br \/>\nHence, the analogRead() takes the help of the Uno\u2019s ADC peripheral, and Uno indeed has the ADC peripheral. <\/span><\/p>\n<p class=\"\" style=\"padding-left: 60px;\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 25px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #333399;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\">lick here:&nbsp;<\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise &#8211; LED control Mealy machine example &nbsp; &nbsp; Light control Mealy machine implementation: In this exercise, we will implement the Light control Mealy machine. For this exercise, you need a Arduino Uno board 1, 5mm LED Jumper wires &nbsp; In this article, you learn about the Arduino board, its peripherals, and its programming [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6508,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[17],"class_list":["post-6496","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-finite-state-machine","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>LED Control Mealy Machine Example: Arduino Uno &amp; PWM Signals<\/title>\n<meta name=\"description\" content=\"Learn to implement a Light Control Mealy machine using Arduino Uno &amp;PWM signals. Explore the basics of Arduino boards, digital &amp; analog pins.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LED Control Mealy Machine Example: Arduino Uno &amp; PWM Signals\" \/>\n<meta property=\"og:description\" content=\"Learn to implement a Light Control Mealy machine using Arduino Uno &amp;PWM signals. Explore the basics of Arduino boards, digital &amp; analog pins.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-12T10:30:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-30T11:11:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FSM Lecture 4- Exercise-001 LED control Mealy machine example\",\"datePublished\":\"2022-01-12T10:30:06+00:00\",\"dateModified\":\"2024-09-30T11:11:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/\"},\"wordCount\":879,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/Arduino-serial-communication-with-HOST.png\",\"keywords\":[\"Finite state Machine(FSM)\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/\",\"name\":\"LED Control Mealy Machine Example: Arduino Uno & PWM Signals\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/Arduino-serial-communication-with-HOST.png\",\"datePublished\":\"2022-01-12T10:30:06+00:00\",\"dateModified\":\"2024-09-30T11:11:32+00:00\",\"description\":\"Learn to implement a Light Control Mealy machine using Arduino Uno &PWM signals. Explore the basics of Arduino boards, digital & analog pins.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/Arduino-serial-communication-with-HOST.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/Arduino-serial-communication-with-HOST.png\",\"width\":1280,\"height\":720,\"caption\":\"Figure 7. Arduino serial(UART) communication with HOST\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/led-control-mealy-machine-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FSM Lecture 4- Exercise-001 LED control Mealy machine example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LED Control Mealy Machine Example: Arduino Uno & PWM Signals","description":"Learn to implement a Light Control Mealy machine using Arduino Uno &PWM signals. Explore the basics of Arduino boards, digital & analog pins.","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:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/","og_locale":"en_US","og_type":"article","og_title":"LED Control Mealy Machine Example: Arduino Uno & PWM Signals","og_description":"Learn to implement a Light Control Mealy machine using Arduino Uno &PWM signals. Explore the basics of Arduino boards, digital & analog pins.","og_url":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-01-12T10:30:06+00:00","article_modified_time":"2024-09-30T11:11:32+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FSM Lecture 4- Exercise-001 LED control Mealy machine example","datePublished":"2022-01-12T10:30:06+00:00","dateModified":"2024-09-30T11:11:32+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/"},"wordCount":879,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png","keywords":["Finite state Machine(FSM)"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/","url":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/","name":"LED Control Mealy Machine Example: Arduino Uno & PWM Signals","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png","datePublished":"2022-01-12T10:30:06+00:00","dateModified":"2024-09-30T11:11:32+00:00","description":"Learn to implement a Light Control Mealy machine using Arduino Uno &PWM signals. Explore the basics of Arduino boards, digital & analog pins.","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Arduino-serial-communication-with-HOST.png","width":1280,"height":720,"caption":"Figure 7. Arduino serial(UART) communication with HOST"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/led-control-mealy-machine-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FSM Lecture 4- Exercise-001 LED control Mealy machine example"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=6496"}],"version-history":[{"count":6,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6496\/revisions"}],"predecessor-version":[{"id":16969,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6496\/revisions\/16969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/6508"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=6496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=6496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=6496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}