{"id":148,"date":"2019-10-23T08:26:02","date_gmt":"2019-10-23T08:26:02","guid":{"rendered":"https:\/\/starthardware.org\/en\/?p=148"},"modified":"2020-09-25T21:58:31","modified_gmt":"2020-09-25T21:58:31","slug":"unit-20-my-digital-cat-2-2","status":"publish","type":"post","link":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/","title":{"rendered":"Unit 20 \u2013 My digital cat 2\/2"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Let\u2019s program our digital cat. It\u2019s still a way to go.<\/p><\/blockquote>\n\n\n\n<p>We have to teach the digital pet some things. It should blink with the eyes (LEDs). It should purr when it\u2019s stroked. It should grumble when it is ignored. Let\u2019s start with the blinking.<\/p>\n\n\n\n<p>(BTW: This is part 2, find Part one here: <a href=\"https:\/\/starthardware.org\/en\/unit-19-my-digital-cat-1-2\/\">https:\/\/starthardware.org\/en\/unit-19-my-digital-cat-1-2\/<\/a> )<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Blinking eyes<\/h3>\n\n\n\n<p>Blinking eyes is actually not that different from the blinking LED example we discussed in the very beginning of that course. The LEDs can be connected to two digital Arduino pins. That means we need the commands pinMode and digitalWrite twice. The code could look like that:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int ledPin1 = 10;\nint ledPin2 = 11;\n\nvoid setup() {\n  pinMode(ledPin1, OUTPUT);\n  pinMode(ledPin2, OUTPUT);\n}\n \nvoid loop() {\n  digitalWrite(ledPin1, HIGH);\n  digitalWrite(ledPin2, HIGH);\n  delay(5000);\n  digitalWrite(ledPin1, LOW);\n  digitalWrite(ledPin2, LOW);\n  delay(50);\n}<\/code><\/pre>\n\n\n\n<p>Now, both LED blink always in in the same speed. That is a bit boring, no? We should randomly blink the LEDs. Fortunately, there is a random-command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Info: random();<\/h3>\n\n\n\n<p>The random(maximum)-command creates a random number between 0 and the as argument given number (maximum). This number is never reached. If you write random(5) the random results are 0, 1, 2, 3 and 4.<\/p>\n\n\n\n<p>Let\u2019s generate a random number between 0 and 500. The eyes (LEDs) should switch off when the random number equals 1. That will create random intervals for eye blinking. Now, we put in a small delay at the end of the program. That will give us the needed break to see, that there is something really happening.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int ledPin1 = 10;\nint ledPin2 = 11;\n\nvoid setup() {\n  pinMode(ledPin1, OUTPUT);\n  pinMode(ledPin2, OUTPUT);  \n}\n \nvoid loop() {\n  \/\/ LEDs on\n  digitalWrite(ledPin1, HIGH);\n  digitalWrite(ledPin2, HIGH);\n  \n  \/\/ blink\n  if (random(500)==1){\n    digitalWrite(ledPin1, LOW);\n    digitalWrite(ledPin2, LOW);\n    delay(50);\n  }\n  \n  delay(10);\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Purring<\/h3>\n\n\n\n<p>The digital pet should purr when it is stroked. To detect if it is stroked, we will use a digital sensor inside. When you stroke it, your hand will cover up some light and the sensor can detect that.<\/p>\n\n\n\n<p>But at first Arduino hast to measure the normal light when the pet is not stroked. It can do it when it is connected to the USB but we have to code it. Let\u2019s store that value into the variable lightNormal: lightNormal=analogRead(sensorPin);<\/p>\n\n\n\n<p>The variable sensorThreshold is used to calibrate the brightness difference when it should start to purr. That is done with if(analogRead(sensorPin)&gt; lightNormal + sensorThreshold){\u2026}. It may be that you have to change the value. Just try out other values if it doesn\u2019t purr.<\/p>\n\n\n\n<p>That is the code without blinking eyes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int sensorPin = 0;\nint sensorThreshold = 20;\n\nint lightNormal;  \n\nvoid setup() {\n  lightNormal = analogRead(sensorPin);\n}\n \nvoid loop() {\n  \/\/ Schnurren\n  if (analogRead(sensorPin)> lightNormal+ sensorThreshold){\n    tone(speakerPin,0.001);\n  } else {\n    noTone(speakerPin);\n  }\n\n  delay(10);\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Grumble<\/h3>\n\n\n\n<p>But what if nobody plays with the pet? When it is ignored for to long, it will play a little melody to get attention. We do it like we did with he blinking eyes. We use a random command. Of course, the pet must not grumble while it is stroked. So we have to connect two conditions. We can do that in the if-statement using the double et-sign (&amp;&amp;).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int sensorPin = 0;\nint sensorThreshold = 20;\n\nint speakerPin = 9;\n\nint lightNormal;  \n \nvoid setup() {\n  lightNormal = analogRead(sensorPin);\n}\n \nvoid loop() {\n\n  \/\/ Meckern\n  if ((random(10000)==1)&amp;&amp;(analogRead(sensorPin)&lt; lightNormal+100)){\n    tone(speakerPin,1200);\n    delay(100);\n    tone(speakerPin,800);\n    delay(200);\n    tone(speakerPin,1000);\n    delay(200);\n    tone(speakerPin,1200);\n    delay(100);\n  }  \n  \n  delay(10);\n}<\/code><\/pre>\n\n\n\n<p>If your digital pet should grumble or not is of course up to you \ud83d\ude09<\/p>\n\n\n\n<p>Here you can find the complete code for the digital pet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int ledPin1 = 10;\nint ledPin2 = 11;\n\nint sensorPin = 0;\nint sensorThreshold = 20;\n\nint speakerPin = 9;\n\nint lightNormal;  \n \nvoid setup() {\n  pinMode(ledPin1, OUTPUT);\n  pinMode(ledPin2, OUTPUT);\n  \n  lightNormal = analogRead(sensorPin);\n}\n \nvoid loop() {\n  \/\/ LEDs on\n  digitalWrite(ledPin1, HIGH);\n  digitalWrite(ledPin2, HIGH);\n  \n  \/\/ blinking\n  if (random(500)==1){\n    digitalWrite(ledPin1, LOW);\n    digitalWrite(ledPin2, LOW);\n    delay(50);\n  }\n  \n  \/\/ purring\n  if (analogRead(sensorPin)> lightNormal+ sensorThreshold){\n    tone(speakerPin,0.001);\n  } else {\n    noTone(speakerPin);\n  }\n  \n  \/\/ grumbling\n  if ((random(10000)==1)&amp;&amp;(analogRead(sensorPin)&lt; lightNormal +100)){\n    tone(speakerPin,1200);\n    delay(100);\n    tone(speakerPin,800);\n    delay(200);\n    tone(speakerPin,1000);\n    delay(200);\n    tone(speakerPin,1200);\n    delay(100);\n  }  \n  \n  delay(10);\n}<\/code><\/pre>\n\n\n\n<p>Wow! That was complicated. Time to tinker something!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Digital Cat \u2013 Paper Model<\/h2>\n\n\n\n<p>Get the paper model files from here:&nbsp;<a href=\"https:\/\/starthardware.org\/wp-content\/uploads\/2014\/11\/Bastelbogen_DigitalesHaustier.pdf\">Download<\/a><\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung1.jpg\" alt=\"\" data-id=\"149\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=149\" class=\"wp-image-149\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung1.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung1-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung1-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Print it on a a heavy paper or cardboard.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung2.jpg\" alt=\"\" data-id=\"150\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=150\" class=\"wp-image-150\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung2.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung2-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung2-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Take the first sheet and cut along the solid lines.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung3.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung3.jpg\" alt=\"\" data-id=\"151\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=151\" class=\"wp-image-151\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung3.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung3-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung3-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Fold along all dashed lines. That works better, when your carve it carefully before.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung4.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung4.jpg\" alt=\"\" data-id=\"152\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=152\" class=\"wp-image-152\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung4.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung4-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung4-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Cut out the second sheet.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung5.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung5.jpg\" alt=\"\" data-id=\"153\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=153\" class=\"wp-image-153\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung5.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung5-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung5-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Mind the cut out in the middle.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung6.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung6.jpg\" alt=\"\" data-id=\"154\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=154\" class=\"wp-image-154\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung6.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung6-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung6-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Now again, fold along the dashed lines.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung7.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung7.jpg\" alt=\"\" data-id=\"155\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=155\" class=\"wp-image-155\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung7.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung7-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung7-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Cut the holes for the eyes. Be careful.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung8.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung8.jpg\" alt=\"\" data-id=\"156\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=156\" class=\"wp-image-156\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung8.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung8-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung8-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Glue it together like shown on the picture. You can either use a glue stick or liquid paper adhesive.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung9.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung9.jpg\" alt=\"\" data-id=\"157\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=157\" class=\"wp-image-157\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung9.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung9-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung9-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Now, stick the backside to the frontside.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung10.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung10.jpg\" alt=\"\" data-id=\"158\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=158\" class=\"wp-image-158\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung10.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung10-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung10-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Close it.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung11.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung11.jpg\" alt=\"\" data-id=\"159\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=159\" class=\"wp-image-159\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung11.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung11-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung11-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">The ears of the pet are a bit difficult to glue. Best, use a pencil to push against it from the inside.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung13.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung13.jpg\" alt=\"\" data-id=\"160\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=160\" class=\"wp-image-160\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung13.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung13-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung13-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Time to put in the electronics. Place the paper model on top of the breadboard. The wires can be bended a bit and put through the cut on the side.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung14.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung14.jpg\" alt=\"\" data-id=\"161\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=161\" class=\"wp-image-161\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung14.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung14-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung14-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Put the LEDs into the cut outs of the eyes. Bend the legs down. (If your calbes are to short, put something unter the breadboard to lift it up.)<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung15.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung15.jpg\" alt=\"\" data-id=\"162\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=162\" class=\"wp-image-162\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung15.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung15-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung15-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Stick the legs onto the paper by using some tape.<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung17.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"533\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung17.jpg\" alt=\"\" data-id=\"163\" data-link=\"https:\/\/starthardware.org\/en\/?attachment_id=163\" class=\"wp-image-163\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung17.jpg 800w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung17-300x200.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/bastelanleitung17-768x512.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Of course you should paint the pet in your taste. If you connect the Arduino to USB, the pet becomes alive!<\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Congratulations!<\/h3>\n\n\n\n<p>You reached the end of that course! We hope it was fun and that you are now able to build your own electronic ideas. Come back soon, we will have new tutorials in the future!<\/p>\n\n\n\n<p>It was great to meet you! All the best from StartHardware!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s program our digital cat. It\u2019s still a way to go. We have to teach the digital pet some things. It should blink with the eyes (LEDs). It should purr when it\u2019s stroked. It should grumble when it is ignored. Let\u2019s start with the blinking. (BTW: This is part 2, find Part one here: https:\/\/starthardware.org\/en\/unit-19-my-digital-cat-1-2\/&hellip;&nbsp;<a href=\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Unit 20 \u2013 My digital cat 2\/2<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":164,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s program our digital cat. It\u2019s still a way to go. We have to teach the digital pet some things. It should blink with the eyes (LEDs). It should purr when it\u2019s stroked. It should grumble when it is ignored. Let\u2019s start with the blinking. (BTW: This is part 2, find Part one here: https:\/\/starthardware.org\/en\/unit-19-my-digital-cat-1-2\/&hellip;&nbsp;Read More &raquo;Unit 20 \u2013 My digital cat 2\/2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/\" \/>\n<meta property=\"og:site_name\" content=\"StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-23T08:26:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-25T21:58:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stefan Hermann\" \/>\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\":\"WebSite\",\"@id\":\"https:\/\/starthardware.org\/en\/#website\",\"url\":\"https:\/\/starthardware.org\/en\/\",\"name\":\"StartHardware - Tutorials for Arduino\",\"description\":\"Arduino, Electronics, Fun\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/starthardware.org\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg\",\"contentUrl\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg\",\"width\":1200,\"height\":675,\"caption\":\"Arduino Digital Cat\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#webpage\",\"url\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/\",\"name\":\"Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino\",\"isPartOf\":{\"@id\":\"https:\/\/starthardware.org\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#primaryimage\"},\"datePublished\":\"2019-10-23T08:26:02+00:00\",\"dateModified\":\"2020-09-25T21:58:31+00:00\",\"author\":{\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\"},\"breadcrumb\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/starthardware.org\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unit 20 \u2013 My digital cat 2\/2\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\",\"name\":\"Stefan Hermann\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"caption\":\"Stefan Hermann\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino","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:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/","og_locale":"en_US","og_type":"article","og_title":"Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino","og_description":"Let\u2019s program our digital cat. It\u2019s still a way to go. We have to teach the digital pet some things. It should blink with the eyes (LEDs). It should purr when it\u2019s stroked. It should grumble when it is ignored. Let\u2019s start with the blinking. (BTW: This is part 2, find Part one here: https:\/\/starthardware.org\/en\/unit-19-my-digital-cat-1-2\/&hellip;&nbsp;Read More &raquo;Unit 20 \u2013 My digital cat 2\/2","og_url":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/","og_site_name":"StartHardware - Tutorials for Arduino","article_published_time":"2019-10-23T08:26:02+00:00","article_modified_time":"2020-09-25T21:58:31+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Stefan Hermann","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/starthardware.org\/en\/#website","url":"https:\/\/starthardware.org\/en\/","name":"StartHardware - Tutorials for Arduino","description":"Arduino, Electronics, Fun","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/starthardware.org\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#primaryimage","inLanguage":"en-US","url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg","contentUrl":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/digital-cat.jpg","width":1200,"height":675,"caption":"Arduino Digital Cat"},{"@type":"WebPage","@id":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#webpage","url":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/","name":"Unit 20 \u2013 My digital cat 2\/2 - StartHardware - Tutorials for Arduino","isPartOf":{"@id":"https:\/\/starthardware.org\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#primaryimage"},"datePublished":"2019-10-23T08:26:02+00:00","dateModified":"2020-09-25T21:58:31+00:00","author":{"@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59"},"breadcrumb":{"@id":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/starthardware.org\/en\/unit-20-my-digital-cat-2-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/starthardware.org\/en\/"},{"@type":"ListItem","position":2,"name":"Unit 20 \u2013 My digital cat 2\/2"}]},{"@type":"Person","@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59","name":"Stefan Hermann","image":{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","caption":"Stefan Hermann"}}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":5,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":391,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/148\/revisions\/391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media\/164"}],"wp:attachment":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}