{"id":1658,"date":"2021-07-20T11:43:01","date_gmt":"2021-07-20T11:43:01","guid":{"rendered":"https:\/\/ydpschool.com\/learnings\/?p=1658"},"modified":"2021-08-01T21:56:06","modified_gmt":"2021-08-01T21:56:06","slug":"1658","status":"publish","type":"post","link":"https:\/\/ydpschool.com\/learnings\/?p=1658","title":{"rendered":"3BAL 3Button and 3LED"},"content":{"rendered":"<p><div class=\"fusion-fullwidth fullwidth-box nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\"  style='background-color: rgba(255,255,255,0);background-position: center center;background-repeat: no-repeat;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;'><div class=\"fusion-builder-row fusion-row \"><div  class=\"fusion-layout-column fusion_builder_column fusion_builder_column_1_1 fusion-builder-column-1 fusion-one-full fusion-column-first fusion-column-last 1_1\"  style='margin-top:0px;margin-bottom:20px;'>\n\t\t\t\t\t<div class=\"fusion-column-wrapper\" style=\"padding: 0px 0px 0px 0px;background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;\"   data-bg-url=\"\">\n\t\t\t\t\t\t<div class=\"fusion-text\"><p>\u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e17\u0e35\u0e48\u0e25\u0e2d\u0e07\u0e17\u0e33\u0e23\u0e30\u0e1a\u0e1a LED \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e25\u0e2d\u0e07\u0e43\u0e0a\u0e49 GPIO \u0e40\u0e1a\u0e37\u0e49\u0e2d\u0e07\u0e15\u0e49\u0e19\u0e41\u0e25\u0e49\u0e27 \u0e04\u0e23\u0e32\u0e27\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e21\u0e32\u0e25\u0e2d\u0e07\u0e17\u0e33\u0e2d\u0e30\u0e44\u0e23\u0e43\u0e2b\u0e49\u0e21\u0e32\u0e01\u0e02\u0e36\u0e49\u0e19\u0e01\u0e31\u0e19<\/p>\n<\/div><div class=\"fusion-text\"><p>\u0e2a\u0e34\u0e48\u0e07\u0e17\u0e35\u0e48\u0e17\u0e33\u0e04\u0e23\u0e31\u0e49\u0e07\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e44\u0e14\u0e49\u0e25\u0e2d\u0e07\u0e43\u0e0a\u0e49 Button \u0e2b\u0e23\u0e37\u0e2d\u0e01\u0e47\u0e04\u0e37\u0e2d\u0e1b\u0e38\u0e48\u0e21\u0e01\u0e14 \u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e19\u0e31\u0e49\u0e19\u0e41\u0e2a\u0e19\u0e07\u0e48\u0e32\u0e22\u0e21\u0e32\u0e01\u0e46 \u0e15\u0e31\u0e27\u0e1b\u0e38\u0e48\u0e21\u0e01\u0e14\u0e19\u0e31\u0e49\u0e19\u0e40\u0e1b\u0e23\u0e35\u0e22\u0e1a\u0e40\u0e2a\u0e21\u0e37\u0e2d\u0e19\u0e2a\u0e30\u0e1e\u0e32\u0e19\u0e44\u0e1f \u0e40\u0e27\u0e25\u0e32\u0e27\u0e32\u0e07\u0e44\u0e27\u0e49\u0e40\u0e09\u0e22\u0e46\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e30\u0e1e\u0e32\u0e19\u0e17\u0e35\u0e48\u0e22\u0e01\u0e15\u0e31\u0e27\u0e02\u0e36\u0e49\u0e19 \u0e41\u0e1a\u0e1a\u0e19\u0e31\u0e49\u0e19\u0e40\u0e25\u0e22\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e44\u0e1f\u0e1c\u0e48\u0e32\u0e19\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49 \u0e41\u0e15\u0e48\u0e1e\u0e2d\u0e01\u0e14\u0e1b\u0e38\u0e48\u0e21\u0e19\u0e31\u0e49\u0e19\u0e25\u0e07\u0e21\u0e32 \u0e2a\u0e30\u0e1e\u0e32\u0e19\u0e01\u0e47\u0e08\u0e30\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e01\u0e31\u0e19\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e44\u0e1f\u0e1f\u0e49\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1c\u0e48\u0e32\u0e19\u0e21\u0e32\u0e44\u0e14\u0e49 \u0e04\u0e25\u0e49\u0e32\u0e22\u0e01\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e34\u0e14\u0e44\u0e1f\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e2a\u0e27\u0e34\u0e15\u0e2a\u0e4c\u0e44\u0e1f\u0e40\u0e25\u0e22<\/p>\n<p>\u0e02\u0e2d\u0e07\u0e40\u0e23\u0e32\u0e43\u0e19\u0e04\u0e23\u0e31\u0e49\u0e07\u0e19\u0e35\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e38\u0e48\u0e21\u0e01\u0e14\u0e17\u0e35\u0e48\u0e21\u0e35\u0e2a\u0e32\u0e21\u0e2a\u0e35\u0e40\u0e25\u0e22\u0e40\u0e2d\u0e32LED\u0e21\u0e32\u0e2a\u0e32\u0e21\u0e2a\u0e35\u0e40\u0e0a\u0e48\u0e19\u0e01\u0e31\u0e19 \u0e01\u0e14\u0e1b\u0e38\u0e48\u0e21\u0e2a\u0e35\u0e44\u0e2b\u0e19\u0e2a\u0e35\u0e19\u0e31\u0e49\u0e19\u0e44\u0e1f\u0e08\u0e30\u0e15\u0e34\u0e14\u0e25\u0e48\u0e30<\/p>\n<\/div><div class=\"fusion-text\"><p style=\"text-align: center;\">\u0e40\u0e02\u0e35\u0e22\u0e19\u0e42\u0e04\u0e49\u0e14\u0e2a\u0e31\u0e48\u0e07\u0e43\u0e2b\u0e49\u0e27\u0e07\u0e08\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e41\u0e25\u0e30\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22<\/p>\n<\/div><div class=\"fusion-clearfix\"><\/div>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\"  style='background-color: rgba(255,255,255,0);background-position: center center;background-repeat: no-repeat;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;'><div class=\"fusion-builder-row fusion-row \"><div  class=\"fusion-layout-column fusion_builder_column fusion_builder_column_1_3 fusion-builder-column-2 fusion-one-third fusion-column-first 1_3\"  style='margin-top:0px;margin-bottom:20px;width:33.33%;width:calc(33.33% - ( ( 4% ) * 0.3333 ) );margin-right: 4%;'>\n\t\t\t\t\t<div class=\"fusion-column-wrapper\" style=\"padding: 0px 0px 0px 0px;background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;\"   data-bg-url=\"\">\n\t\t\t\t\t\t<style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters { background-color: ; }.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-linenumber { color: ; }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-1 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-left:0px;margin-bottom:0px;margin-right:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#eaeaea;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_1\" style=\"font-size:14px;\">Copy to Clipboard<\/span><\/div><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_1\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\">import RPi.GPIO as GPIO\nimport time\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BOARD)\nLEDR = GPIO.setup(3,GPIO.OUT)\nLEDG = GPIO.setup(5,GPIO.OUT)\nLEDY = GPIO.setup(7,GPIO.OUT)\nButtonR= GPIO.setup(11,GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\nButtonG = GPIO.setup(13,GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\nButtonY = GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\n\ntry:\n    while True:\n         button_stateR = GPIO.input(ButtonR)\n         if button_state == False:\n             GPIO.output(LEDR, True)\n             time.sleep(0.2)\n         else:\n             GPIO.output(LEDR, False)\n\t\tbutton_stateG = GPIO.input(ButtonG)\n         if button_state == False:\n             GPIO.output(LEDG, True)\n             time.sleep(0.2)\n         else:\n             GPIO.output(LEDG, False)\n\t\tbutton_stateY = GPIO.input(ButtonY)\n         if button_state == False:\n             GPIO.output(LEDY, True)\n             time.sleep(0.2)\n         else:\n             GPIO.output(LEDY, False)\nexcept:\n    GPIO.cleanup()\n<\/textarea><\/div><div class=\"fusion-clearfix\"><\/div>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div><div  class=\"fusion-layout-column fusion_builder_column fusion_builder_column_2_3 fusion-builder-column-3 fusion-two-third fusion-column-last 2_3\"  style='margin-top:0px;margin-bottom:20px;width:66.66%;width:calc(66.66% - ( ( 4% ) * 0.6666 ) );'>\n\t\t\t\t\t<div class=\"fusion-column-wrapper\" style=\"padding: 0px 0px 0px 0px;background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;\"   data-bg-url=\"\">\n\t\t\t\t\t\t<div class=\"fusion-text\"><p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 1 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e19\u0e33 Library \u0e02\u0e2d\u0e07 Raspberry Pi \u0e21\u0e32\u0e43\u0e0a\u0e49 \u0e42\u0e14\u0e22\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e40\u0e23\u0e35\u0e22\u0e01\u0e43\u0e0a\u0e49 GPIO<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 2 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e19\u0e33 Library Time(\u0e40\u0e27\u0e25\u0e32) \u0e21\u0e32\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e42\u0e04\u0e49\u0e14\u0e19\u0e35\u0e49<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 3 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e40\u0e0b\u0e47\u0e15\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e44\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e21\u0e35\u0e41\u0e08\u0e49\u0e07\u0e40\u0e15\u0e37\u0e2d\u0e19<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 4 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e40\u0e0b\u0e47\u0e15\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 GPIO \u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e02\u0e2d\u0e07\u0e1e\u0e34\u0e19<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 5-10\u00a0 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e1a\u0e2d\u0e01 Raspberry Pi \u0e27\u0e48\u0e32\u0e40\u0e23\u0e32\u0e43\u0e0a\u0e49\u0e1e\u0e34\u0e19\u0e44\u0e2b\u0e19\u0e17\u0e33\u0e07\u0e32\u0e19\u0e1a\u0e49\u0e32\u0e07(\u0e43\u0e19\u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e43\u0e0a\u0e49\u0e1e\u0e34\u0e19\u0e17\u0e35\u0e48 3,5\u0e41\u0e25\u0e30 7 \u0e40\u0e1b\u0e47\u0e19LED \u0e2a\u0e48\u0e27\u0e19\u0e1e\u0e34\u0e19\u0e17\u0e35\u0e48 11,13 \u0e41\u0e25\u0e30 15 \u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e38\u0e48\u0e21\u0e01\u0e14)<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 12 \u0e41\u0e25\u0e30 32 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e17\u0e35\u0e48\u0e43\u0e2b\u0e49\u0e23\u0e30\u0e1a\u0e1a\u0e25\u0e2d\u0e07\u0e40\u0e02\u0e49\u0e32\u0e21\u0e32\u0e14\u0e49\u0e32\u0e19\u0e43\u0e19\u0e19\u0e35\u0e49\u0e01\u0e48\u0e2d\u0e19 \u0e16\u0e49\u0e32\u0e17\u0e33\u0e44\u0e14\u0e49\u0e08\u0e30\u0e40\u0e02\u0e49\u0e32 try \u0e41\u0e15\u0e48\u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e48\u0e08\u0e30\u0e40\u0e02\u0e49\u0e32 except<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e17\u0e35\u0e48 13 \u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e31\u0e48\u0e07\u0e43\u0e2b\u0e49\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e40\u0e1b\u0e47\u0e19\u0e41\u0e1a\u0e1a\u0e25\u0e39\u0e1b \u0e0b\u0e36\u0e48\u0e07\u0e41\u0e1b\u0e25\u0e27\u0e48\u0e32\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e22\u0e46\u0e08\u0e19\u0e01\u0e27\u0e48\u0e32\u0e40\u0e23\u0e32\u0e08\u0e30\u0e2b\u0e22\u0e38\u0e14<\/p>\n<p>\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14 if else \u0e08\u0e30\u0e21\u0e35\u0e2d\u0e22\u0e39\u0e48\u0e2a\u0e32\u0e21\u0e01\u0e25\u0e38\u0e48\u0e21 \u0e41\u0e22\u0e01\u0e15\u0e32\u0e21\u0e2a\u0e35\u0e02\u0e2d\u0e07\u0e1b\u0e38\u0e48\u0e21\u0e41\u0e25\u0e30LED \u0e42\u0e14\u0e22\u0e40\u0e23\u0e32\u0e08\u0e30\u0e23\u0e31\u0e1a\u0e04\u0e48\u0e32\u0e01\u0e32\u0e23\u0e01\u0e14\u0e40\u0e02\u0e49\u0e32\u0e21\u0e32\u0e01\u0e48\u0e2d\u0e19 \u0e16\u0e49\u0e32\u0e40\u0e23\u0e32\u0e01\u0e14\u0e08\u0e30\u0e40\u0e02\u0e49\u0e32 if \u0e40\u0e21\u0e37\u0e48\u0e2d\u0e1b\u0e25\u0e48\u0e2d\u0e22\u0e08\u0e30\u0e40\u0e02\u0e49\u0e32 else<\/p>\n<\/div><div class=\"fusion-clearfix\"><\/div>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div><\/div><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/posts\/1658"}],"collection":[{"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1658"}],"version-history":[{"count":9,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/posts\/1658\/revisions"}],"predecessor-version":[{"id":1667,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=\/wp\/v2\/posts\/1658\/revisions\/1667"}],"wp:attachment":[{"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ydpschool.com\/learnings\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}