{"id":631,"date":"2023-03-17T22:27:15","date_gmt":"2023-03-17T22:27:15","guid":{"rendered":"http:\/\/bussigel.com\/newinstruments\/?page_id=631"},"modified":"2025-09-20T00:07:58","modified_gmt":"2025-09-20T00:07:58","slug":"digital-outputs","status":"publish","type":"page","link":"https:\/\/bussigel.com\/newinstruments\/digital-outputs\/","title":{"rendered":"digital outputs"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"616\" src=\"http:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2025\/09\/6.png\" alt=\"\" class=\"wp-image-749\" style=\"width:489px;height:auto\" srcset=\"https:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2025\/09\/6.png 1024w, https:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2025\/09\/6-664x399.png 664w, https:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2025\/09\/6-768x462.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>Connect the Anode (+) or longer leg of the LED to one of your digital output pins \u2014 in this case Pin 9. Connect the&nbsp;shorter, or cathode, leg to ground through a 220\u03a9 resistor (red&nbsp;red&nbsp;brown&nbsp;gold).<\/p>\n\n\n\n<p>If you play the MIDI note associated with pin 9, the pin is turned on, or set to HIGH, and will send 3.3v through the LED and the resistor, completing the circuit to ground. Your LED should turn on! Let\u2019s look at the code\u2026<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Instantiate an array of NoteLED objects that receive midi note events from the \n\/\/ computer to turn LEDs on and off on the microcontroller \nNoteLED leds&#91;]{ \n{9, MIDI_Notes::E(4)}, \/\/ pin 9: LED output (midi note E4 or 64) \n};<\/code><\/pre>\n\n\n\n<p>Create a NoteLED object and set up an array, leds[]. The array lets you easily add more leds if you want. Next specify the pin (9) and the MIDI note that the pin responds to, note E4.<\/p>\n\n\n\n<p>You can use a&nbsp;similar setup to drive a small vibration motor. Connect one leg of the motor (it really doesn\u2019t matter which leg in this case) to power (red) and the&nbsp;other leg to ground through a 10K resistor. You won\u2019t be able to control the speed of the motor, but you\u2019ll be able to turn it on and off from your computer by sending a MIDI note. A better way to connect a motor uses a new component called.a transistor. <br><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"682\" data-id=\"719\" src=\"http:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2023\/10\/simple-motor-control.jpg\" alt=\"\" class=\"wp-image-719\" srcset=\"https:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2023\/10\/simple-motor-control.jpg 651w, https:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2023\/10\/simple-motor-control-634x664.jpg 634w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"500\" data-id=\"720\" src=\"http:\/\/bussigel.com\/newinstruments\/wp-content\/uploads\/2023\/10\/1acc6288c8c249b3132b49ee43006f5cf79c1d00.png\" alt=\"\" class=\"wp-image-720\"\/><\/figure>\n<\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Connect the Anode (+) or longer leg of the LED to one of your digital output pins \u2014 in this case Pin 9. Connect the&nbsp;shorter, or cathode, leg to ground through a 220\u03a9 resistor (red&nbsp;red&nbsp;brown&nbsp;gold). If you play the MIDI note associated with pin 9, the pin is turned on, or set to HIGH, and &hellip; <a href=\"https:\/\/bussigel.com\/newinstruments\/digital-outputs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">digital outputs<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-631","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/pages\/631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/comments?post=631"}],"version-history":[{"count":4,"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/pages\/631\/revisions"}],"predecessor-version":[{"id":753,"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/pages\/631\/revisions\/753"}],"wp:attachment":[{"href":"https:\/\/bussigel.com\/newinstruments\/wp-json\/wp\/v2\/media?parent=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}