{"id":17763,"date":"2022-01-27T00:00:48","date_gmt":"2022-01-26T16:00:48","guid":{"rendered":"https:\/\/techclass.wfjydl.com\/?p=17763"},"modified":"2022-03-28T15:02:30","modified_gmt":"2022-03-28T07:02:30","slug":"%e4%bd%bf%e7%94%a8raspberry-pi%e5%92%8carduino-uno%e6%9e%84%e5%bb%ba%e6%b3%a2%e8%a1%a8%e5%90%88%e6%88%90%e5%99%a8","status":"publish","type":"post","link":"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/engineer\/how-tos\/raspberry\/building-a-wavetable-synthesizer-with-a-raspberry-pi-and-an-arduino-uno","title":{"rendered":"\u4f7f\u7528Raspberry Pi\u548cArduino Uno\u6784\u5efa\u6ce2\u8868\u5408\u6210\u5668"},"content":{"rendered":"<div class=\"the_content_wrapper\">\n\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e<a href=\"https:\/\/www.deviceplus.com\/\">DevicePlus.com<\/a>\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002<\/p>\n<p>\u4e0d\u4e45\u524d\uff0c\u6211\u4eec\u7814\u7a76\u4e86\u5982\u4f55\u4f7f\u7528Raspberry Pi\u7684I2C\u603b\u7ebf\u6765\u63a7\u5236Arduino Uno\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u6765\u8f93\u51fa\u6a21\u62df\u7535\u538b\u3002<\/p>\n<p>\u4ee4\u4eba\u5174\u594b\u7684\u662f\uff0c\u5b8c\u6210\u8fd9\u4e9b\u9879\u76ee\u540e\uff0c\u60a8\u5c31\u5df2\u7ecf\u638c\u63e1\u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u5408\u6210\u5668\u7684\u5927\u90e8\u5206\u65b9\u6cd5\u4e86\u3002<\/p>\n<p>\u5e76\u4e14\u4e00\u5bb6\u540d\u53ebdzl\u7684\u5236\u9020\u5546\u5df2\u7ecf\u53d1\u5e03\u4e86\u4e00\u7ec4\u540d\u4e3athe_synth\u7684Arduino\u5e93\uff0c\u6211\u4eec\u53ef\u4ee5\u9a6c\u4e0a\u5b89\u88c5\u5e76\u4f7f\u7528\u8be5\u5e93\u3002<\/p>\n<p>\u90a3\u4e48\uff0c\u5c31\u8ba9\u6211\u4eec\u6765\u4e00\u8d77\u5b8c\u6210\u8fd9\u4e2a\u9879\u76ee\u5427\uff01\u73b0\u5728\uff0c\u6211\u4eec\u6765\u6784\u5efa\u4e00\u4e2a\u6ce2\u8868\u5408\u6210\u5668\u3002<\/p>\n<h3>\u201c\u6ce2\u8868\u201d\u5408\u6210\u5668\u662f\u4ec0\u4e48\u610f\u601d\uff1f<\/h3>\n<p>\u4e00\u4e2a\u6ce2\u8868\u5408\u6210\u5668\u53ef\u4ee5\u5c06\u4e00\u7cfb\u5217\u7b80\u5355\u6ce2\u5f62\u4ee5\u4e0d\u540c\u7535\u538b\u7535\u5e73\u6ce2\u8868\u6587\u4ef6\u7684\u5f62\u5f0f\u5b58\u50a8\u5728\u5b58\u50a8\u5668\u4e2d\u3002<\/p>\n<p>\u5408\u6210\u5668\u5c06\u8fd9\u4e9b\u7535\u538b\u4ee5\u4e0d\u540c\u7684\u901f\u7387\u8f93\u51fa\uff0c\u6765\u4ea7\u751f\u76f8\u5e94\u9891\u7387\u7684\u97f3\u8c03\u3002<\/p>\n<p>\u6211\u4eec\u53ea\u9700\u8981\u5b58\u50a8\u6bcf\u79cd\u6ce2\u5f62\u7684\u4e00\u4e2a\u5468\u671f\uff0c\u8fd9\u662f\u4e00\u79cd\u53ef\u4ee5\u9ad8\u6548\u8282\u7701\u5185\u5b58\u7684\u65b9\u6cd5\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u7528\u4e8e\u5185\u5b58\u6709\u9650\u7684\u7b80\u5355\u5fae\u63a7\u5236\u5668\u3002<\/p>\n<p>\u5728the_synth\u91cc\uff0c\u60a8\u53ef\u4ee5\u5728tables.h\u6587\u4ef6\u4e2d\u627e\u5230\u6ce2\u8868\u3002\u60a8\u4e5f\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91\u8be5\u6587\u4ef6\u6765\u521b\u5efa\u81ea\u5df1\u7684\u6ce2\u8868\u3002<\/p>\n<p>\u7136\u540e\uff0c\u6211\u4eec\u901a\u8fc7\u628aArduino Uno\u7684PWM\u786c\u4ef6\u8fde\u63a5\u5230\u4f4e\u901a\u6ee4\u6ce2\u5668\uff0c\u5c06\u5185\u5b58\u4e2d\u7684\u8fd9\u4e9b\u6570\u503c\u8f6c\u6362\u4e3a\u6a21\u62df\u7535\u538b\uff0c\u5982\u4e4b\u524d\u7684\u9879\u76ee\u4e2d\u6240\u63cf\u8ff0\u7684\u90a3\u6837\u3002<\/p>\n<h3>\u6240\u9700\u90e8\u4ef6<\/h3>\n<table width=\"642\">\n<tbody>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/thepihut.com\/products\/raspberry-pi-4-model-b?variant=20064052674622&amp;currency=GBP&amp;utm_medium=product_sync&amp;utm_source=google&amp;utm_content=sag_organic&amp;utm_campaign=sag_organic&amp;gclid=Cj0KCQjwlN32BRCCARIsADZ-J4s5VAXINFtbw9Of96pQszrsr3iA4kdZung_1ozb7Qjq6Kgl6Rku8h0aAsfUEALw_wcB\">Raspberry Pi<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10160\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1.png\" alt=\"\" width=\"500\" height=\"500\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1.png 500w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-300x300.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-150x150.png 150w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-146x146.png 146w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-50x50.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-75x75.png 75w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-85x85.png 85w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth1-80x80.png 80w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/www.amazon.co.uk\/Sintron-Extension-Rainbow-Ribbon-Raspberry\/dp\/B00NWA2AS0\">\u4e00\u4e2aGPIO\u6269\u5c55\u677f<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10161\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2.jpg\" alt=\"\" width=\"1500\" height=\"1125\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2.jpg 1500w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-300x225.jpg 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-1024x768.jpg 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-768x576.jpg 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-195x146.jpg 195w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-50x38.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth2-100x75.jpg 100w\" sizes=\"auto, (max-width: 1500px) 100vw, 1500px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/uk.rs-online.com\/web\/p\/breadboards\/8352716\/\">\u4e00\u4e2a\u65e0\u710a\u9762\u5305\u677f<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10162\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3.png\" alt=\"\" width=\"197\" height=\"345\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3.png 197w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3-171x300.png 171w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3-83x146.png 83w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3-29x50.png 29w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth3-43x75.png 43w\" sizes=\"auto, (max-width: 197px) 100vw, 197px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/store.arduino.cc\/arduino-uno-rev3\">\u4e00\u4e2aArduino Uno<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10163\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth4.png\" alt=\"\" width=\"231\" height=\"164\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth4.png 231w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth4-206x146.png 206w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth4-50x35.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth4-106x75.png 106w\" sizes=\"auto, (max-width: 231px) 100vw, 231px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/uk.rs-online.com\/web\/p\/through-hole-fixed-resistors\/7397459\/\">\u4e00\u4e2a1k\u6b27\u59c6\u7535\u963b<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10164\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5.png\" alt=\"\" width=\"1200\" height=\"679\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5.png 1200w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-300x170.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-1024x579.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-768x435.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-258x146.png 258w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-50x28.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth5-133x75.png 133w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/uk.rs-online.com\/web\/p\/mica-capacitors\/1683290\/?cm_mmc=UK-PLA-DS3A-_-google-_-CSS_UK_EN_Passive_Components_Whoop-_-Mica+Capacitors_Whoop-_-1683290&amp;matchtype=&amp;aud-827186183686:pla-307933503741&amp;gclid=CjwKCAiAgc-ABhA7EiwAjev-jyD7nS0sEsG8hd6mlwrLi1Ttz2PwknspMrSllqODU_ct7FT76SLPfxoCC3EQAvD_BwE&amp;gclsrc=aw.ds\">\u4e00\u4e2a10nF\u7535\u5bb9<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10165\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth6.png\" alt=\"\" width=\"225\" height=\"169\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth6.png 225w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth6-194x146.png 194w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth6-50x38.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth6-100x75.png 100w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/uk.rs-online.com\/web\/p\/aluminium-capacitors\/5261828\/?cm_mmc=UK-PLA-DS3A-_-google-_-CSS_UK_EN_Passive_Components_Whoop-_-Aluminium+Capacitors_Whoop+(2)-_-5261828&amp;matchtype=&amp;aud-827186183926:pla-370789465128&amp;gclid=CjwKCAiAgc-ABhA7EiwAjev-j6A8ET90jeyzeQXbAOwqTrYrwITmokQ40ZNsK0NHBrGMq4irlR3dtxoCUa4QAvD_BwE&amp;gclsrc=aw.ds\">\u4e00\u4e2a220uF\u7535\u5bb9<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10166\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7.png\" alt=\"\" width=\"544\" height=\"197\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7.png 544w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7-300x109.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7-260x94.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7-50x18.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth7-150x54.png 150w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/td>\n<\/tr>\n<tr>\n<td width=\"321\"><a href=\"https:\/\/uk.rs-online.com\/web\/p\/pc-speakers\/2013518\/?cm_mmc=UK-PLA-DS3A-_-google-_-CSS_UK_EN_Computing_%26_Peripherals_Whoop-_-PC+Speakers_Whoop-_-2013518&amp;matchtype=&amp;aud-828197004210:pla-357707179807&amp;gclid=CjwKCAiAgc-ABhA7EiwAjev-jy2dnX1S40SnwVfCNsBEXzFzpzZF1W305ZhmHWbLyaq3pl23srngahoC8_kQAvD_BwE&amp;gclsrc=aw.ds\">\u4e00\u4e2a\u6709\u6e90\u626c\u58f0\u5668<\/a><\/td>\n<td width=\"321\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10167\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8.jpg\" alt=\"\" width=\"2500\" height=\"1945\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8.jpg 2500w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-300x233.jpg 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-1024x797.jpg 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-768x598.jpg 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-1536x1195.jpg 1536w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-2048x1593.jpg 2048w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-188x146.jpg 188w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-50x39.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth8-96x75.jpg 96w\" sizes=\"auto, (max-width: 2500px) 100vw, 2500px\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u597d\u4e0d\u8981\u4f7f\u7528\u6602\u8d35\u7684\u6709\u6e90\u626c\u58f0\u5668\u6765\u6784\u5efa\u548c\u6d4b\u8bd5DIY\u5408\u6210\u5668\u6216\u97f3\u9891\u9879\u76ee\u3002\u867d\u7136\u8fd9\u6837\u7684\u7535\u8def\u4e0d\u4e00\u5b9a\u4f1a\u635f\u574f\u60a8\u7684\u4e1c\u897f\uff0c\u4f46\u662f\u4e3a\u4ec0\u4e48\u8981\u5192\u9669\u5462\uff1f<\/p>\n<p>\u6211\u4e00\u76f4\u4f7f\u7528\u7684\u90fd\u662f\u4ece\u4e8c\u624b\u5546\u5e97\u82b15\u7f8e\u5143\u8d2d\u4e70\u7684\u5927\u578b\u65e7\u56fa\u6001\u9ad8\u4fdd\u771f\u97f3\u54cd\u3002\u4e00\u4e9b\u65e7\u7684\u7535\u8111\u626c\u58f0\u5668\u4e5f\u662f\u4e0d\u9519\u7684\u9009\u62e9\u3002<\/p>\n<h3>\u5b89\u88c5\u793a\u4f8b<\/h3>\n<p>The_synth\u9644\u5e26\u4e86\u8bb8\u591a\u793a\u4f8b\u7528\u4e8e\u6f14\u793a\u5176\u4f7f\u7528\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5b83\u4eec\u3002\u5728\u6df1\u5165\u7814\u7a76\u4ee3\u7801\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u8bd5\u4e00\u4e0b\u5176\u4e2d\u4e00\u4e2a\u793a\u4f8b\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u5728\u60a8\u7684Arduino IDE\u4e2d\u5b89\u88c5\u5e93\u548c\u5176\u4e2d\u7684\u793a\u4f8b\uff0c\u8bf7\u524d\u5f80 https:\/\/github.com\/dzlonline\/the_synth\u5e76\u70b9\u51fb\u5728\u9875\u9762\u53f3\u4e0a\u65b9\u6807\u6709<em>Code.<\/em>\u7684\u7eff\u8272\u6309\u94ae\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10168\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9.png\" alt=\"\" width=\"1289\" height=\"730\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9.png 1289w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-300x170.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-1024x580.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-768x435.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-258x146.png 258w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-50x28.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth9-132x75.png 132w\" sizes=\"auto, (max-width: 1289px) 100vw, 1289px\" \/><\/p>\n<p>\u70b9\u51fb<em>Download ZIP<\/em>\uff0c\u5e76\u4fdd\u5b58\u8be5\u6587\u4ef6\u3002<\/p>\n<p>\u73b0\u5728\u6253\u5f00Arduino IDE\u3002\u5728<em>Sketch<\/em>\u83dc\u5355\u4e2d\uff0c\u5c06\u5149\u6807\u653e\u5728<em>Include Library<\/em>\u5904\uff0c\u7136\u540e\u70b9\u51fb<em>Add .ZIP library&#8230;<\/em>\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10169\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10.png\" alt=\"\" width=\"1073\" height=\"726\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10.png 1073w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-300x203.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-1024x693.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-768x520.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-216x146.png 216w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth10-111x75.png 111w\" sizes=\"auto, (max-width: 1073px) 100vw, 1073px\" \/><\/p>\n<p>\u627e\u5230\u6211\u4eec\u4e4b\u524d\u4fdd\u5b58\u7684.zip\u6587\u4ef6\uff0c\u9009\u62e9\u5b83\u5e76\u70b9\u51fb\u201cOK\u201d\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10170\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11.jpg\" alt=\"\" width=\"1014\" height=\"832\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11.jpg 1014w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11-300x246.jpg 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11-768x630.jpg 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11-178x146.jpg 178w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11-50x41.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth11-91x75.jpg 91w\" sizes=\"auto, (max-width: 1014px) 100vw, 1014px\" \/><\/p>\n<p>\u60a8\u73b0\u5728\u5df2\u7ecf\u6210\u529f\u5c06the_synth\u5b89\u88c5\u5230\u4e86\u60a8\u7684IDE\u4e2d\uff0c\u5e76\u4e14\u53ef\u4ee5\u4ece\u83dc\u5355\u4e2d\u8bbf\u95ee\u5e93\u548c\u793a\u4f8b\u4e86\u3002\u8ba9\u6211\u4eec\u8bd5\u8bd5any_hertz\u793a\u4f8b\uff0c\u5b83\u53ef\u4ee5\u5faa\u73af\u904d\u5386\u56db\u79cd\u4e0d\u540c\u7684\u9891\u7387\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10171\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12.jpg\" alt=\"\" width=\"646\" height=\"944\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12.jpg 646w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12-205x300.jpg 205w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12-100x146.jpg 100w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12-34x50.jpg 34w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth12-51x75.jpg 51w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u6253\u5f00\u201cFile\u201d\u83dc\u5355\uff0c\u5c06\u9f20\u6807\u505c\u7559\u5728<em>Examples<\/em>\u5904\uff0c\u7136\u540e\u6eda\u52a8\u5230\u5e95\u90e8\u81f3<em>the_synth-master.<\/em>\u627e\u5230\u8be5\u793a\u4f8b\u3002\u5c06\u9f20\u6807\u505c\u7559\u5728\u8be5\u9009\u62e9\u4e0a\uff0c\u5e76\u70b9\u51fb<em>any_hertz<\/em>\u6765\u6253\u5f00\u8349\u56fe\u3002<\/p>\n<p>\u73b0\u5728\u901a\u8fc7USB\u8fde\u63a5Arduino Uno\uff0c\u8bf7\u518d\u6b21\u786e\u8ba4\u60a8\u9009\u62e9\u4e86Arduino Uno\uff0c\u786e\u8ba4\u540e\u4e0a\u4f20\u8349\u56fe\u3002<\/p>\n<h3>\u63a5\u7ebf<\/h3>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u9700\u8981\u5c06Arduino Uno\u8fde\u63a5\u5230\u4e00\u4e2a\u7b80\u5355\u7684\u4f4e\u901a\u6ee4\u6ce2\u5668\uff0c\u5c31\u50cf\u4e4b\u524d\u6784\u5efa\u9879\u76ee\u4e2d\u6240\u505a\u7684\u90a3\u6837\uff0c\u7136\u540e\u5c06\u5b83\u8fde\u63a5\u5230\u6211\u4eec\u7684\u626c\u58f0\u5668\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4ece\u8fde\u63a5\u7535\u6e90\u5f15\u811a\u5f00\u59cb\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10172\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13.png\" alt=\"\" width=\"1280\" height=\"871\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13.png 1280w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-300x204.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-1024x697.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-768x523.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-215x146.png 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth13-110x75.png 110w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><br \/>\n\u5c06\u5f15\u811a11\uff08\u5373PWM\u5f15\u811a\uff09\u8fde\u63a5\u5230\u9762\u5305\u677f\u7684\u4e2d\u95f4\u3002\u6211\u4eec\u8fd8\u9700\u8981\u63a5\u5730\u6765\u6784\u5efa\u4f4e\u901a\u6ee4\u6ce2\u5668\uff0c\u56e0\u6b64\u5c06\u63a5\u5730\u5f15\u811a\u8fde\u63a5\u5230\u8d1f\u7535\u6e90\u8f68\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10173\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14.png\" alt=\"\" width=\"1280\" height=\"871\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14.png 1280w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-300x204.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-1024x697.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-768x523.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-215x146.png 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth14-110x75.png 110w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>\u73b0\u5728\u6784\u5efa\u4f4e\u901a\u6ee4\u6ce2\u5668\u3002\u5c061k\u7535\u963b\u8fde\u63a5\u5230PWM\u5f15\u811a\uff0c\u7136\u540e\u5c0610nF\u7535\u5bb9\u8fde\u63a5\u5230\u7535\u963b\u7684\u53e6\u4e00\u7aef\u548c\u63a5\u5730\u8f68\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10174\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15.png\" alt=\"\" width=\"1280\" height=\"871\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15.png 1280w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-300x204.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-1024x697.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-768x523.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-215x146.png 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth15-110x75.png 110w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>\u73b0\u5728\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u8026\u5408\u7535\u5bb9\u5668\uff0c\u4ee5\u786e\u4fdd\u4e0d\u4f1a\u901a\u8fc7\u4efb\u4f55\u76f4\u6d41\u7535\u3002\u9700\u8981\u8bb0\u4f4f\u7684\u4e00\u70b9\u662f\u7535\u89e3\u7535\u5bb9\u5668\u662f\u6709\u6781\u6027\u7684\uff0c\u56e0\u6b64\u8bf7\u5c06\u9633\u6781\uff08\u8f83\u957f\u7aef\uff09\u8fde\u63a5\u5230\u4f4e\u901a\u6ee4\u6ce2\u5668\uff0c\u53e6\u4e00\u7aef\u8fde\u63a5\u5230\u9762\u5305\u677f\u4e0b\u65b9\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10175\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16.png\" alt=\"\" width=\"1280\" height=\"871\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16.png 1280w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-300x204.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-1024x697.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-768x523.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-215x146.png 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth16-110x75.png 110w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>\u5c06\u626c\u58f0\u5668\u8fde\u63a5\u5230\u8026\u5408\u7535\u5bb9\u5668\u7684\u9634\u6781\uff0c\u5982\u6709\u9700\u8981\u53ef\u4ee5\u63a5\u5730\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5df2\u7ecf\u6b63\u786e\u5b8c\u6210\u4e86\u6240\u6709\u8fde\u63a5\uff0c\u60a8\u73b0\u5728\u5c06\u4f1a\u542c\u5230\u4e00\u7ec4\u5305\u542b\u56db\u79cd\u97f3\u8c03\u7684\u58f0\u97f3\u3002<\/p>\n<h3>\u4f7f\u7528I2C \u548cRaspberry Pi\u63a7\u5236\u5408\u6210\u5668<\/h3>\n<p>\u60a8\u73b0\u5728\u53ef\u4ee5\u542c\u5230\u81ea\u5df1\u6240\u6784\u5efa\u7684\u6ce2\u8868\u5408\u6210\u5668\u6240\u53d1\u51fa\u7684\u58f0\u97f3\u4e86\uff0c\u662f\u4e0d\u662f\u5f88\u9177\uff1f<\/p>\n<p>\u4f46\u53ea\u662f\u4e00\u904d\u53c8\u4e00\u904d\u5730\u542c\u7740\u8fd9\u56db\u79cd\u97f3\u8c03\u5e76\u4e0d\u662f\u5f88\u6709\u8da3\u3002\u6211\u4eec\u60f3\u8981\u80fd\u591f\u4f7f\u7528Raspberry Pi\u5bf9\u5176\u8fdb\u884c\u63a7\u5236\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u5728I2C\u603b\u7ebf\u4e0a\u4f7f\u7528Arduino\u7684Wire\u5e93\u548cPython\u4e2d\u7684SMBus\u6a21\u5757\uff08\u6211\u4eec\u4e4b\u524d\u4ecb\u7ecd\u8fc7\uff09\u6765\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002<\/p>\n<h3>\u5bf9Arduino Uno\u7f16\u7a0b<\/h3>\n<p>\u6211\u4eec\u771f\u6b63\u9700\u8981\u505a\u7684\u662f\u5c06\u8fd9\u4e2a<em>any_hertz<\/em>\u793a\u4f8b\u548c\u4e4b\u524d\u7f16\u5199\u7684I2C\u7a0b\u5e8f\u6574\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u64ad\u653e\u6211\u4eec\u53d1\u9001\u7684\u97f3\u7b26\u3002<br \/>\n\u6211\u4eec\u5148\u5bfc\u5165I2C\u548csynth\u5e93\u3002<br \/>\n<span style=\"color: #3366ff;\">#include &lt;Wire.h&gt;<\/span><br \/>\n<span style=\"color: #3366ff;\">#include &lt;synth.h&gt;<\/span><\/p>\n<p>\u6bcf\u4e2aArduino\u8349\u56fe\u90fd\u9700\u8981\u4e00\u4e2a\u8bbe\u7f6e\u51fd\u6570\uff0c\u5728\u6211\u4eec\u7684\u8bbe\u7f6e\u51fd\u6570\u4e2d\uff0c\u9700\u8981\u5b8c\u6210\u4e09\u4ef6\u4e8b\u60c5\uff1a\u4f5c\u4e3a\u4ece\u673a\u52a0\u5165I2C\u603b\u7ebf\uff1b\u521d\u59cb\u5316\u6211\u4eec\u7684\u5408\u6210\u5668\uff1b\u4ee5\u53ca\u5728\u6536\u5230I2C\u6307\u4ee4\u65f6\u8c03\u7528\u53e6\u4e00\u4e2a\u51fd\u6570\u3002<br \/>\n\u6211\u4eec\u53ef\u4ee5\u6309\u7167\u5982\u4e0b\u6240\u793a\u7f16\u5199\uff1a<br \/>\n<span style=\"color: #3366ff;\">void setup() {<\/span><\/p>\n<p><span style=\"color: #3366ff;\">edgar.begin(); \/\/-Start up a synth<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setupVoice(0,TRIANGLE,60,ENVELOPE1,127,64); \/\/-Set up voice 0<\/span><\/p>\n<p><span style=\"color: #3366ff;\">Wire.begin(0x8); \/\/ Join the I2C Bus as a slave at address 0x8<\/span><br \/>\n<span style=\"color: #3366ff;\">Wire.onReceive(readInstruction); \/\/ On<\/span><br \/>\n<span style=\"color: #3366ff;\">}<\/span><\/p>\n<p>\u73b0\u5728\u6211\u4eec\u9700\u8981\u7f16\u5199readInstruction()\u51fd\u6570\u3002\u8be5\u51fd\u6570\u7528\u4e8e\u4eceI2C\u603b\u7ebf\u8bfb\u53d6\u4e00\u4e2a\u6570\u5b57\u3002\u5982\u679c\u8bfb\u53d6\u4e860\uff0c\u90a3\u4e48\u5c06\u4e0d\u64ad\u653e\u4efb\u4f55\u4e1c\u897f\u3002\u5982\u679c\u8bfb\u53d6\u4e861\u52308\u4e4b\u95f4\u7684\u6570\u5b57\uff0c\u90a3\u4e48\u5c06\u4f1a\u64ad\u653eA1\u5230A2\u4e4b\u95f4\u7684\u4e00\u4e2a\u97f3\u7b26\u3002<br \/>\n<span style=\"color: #3366ff;\">void readInstruction(int bitstream) {<\/span><br \/>\n<span style=\"color: #3366ff;\">byte option = Wire.read();<\/span><br \/>\n<span style=\"color: #3366ff;\">switch (option) {<\/span><br \/>\n<span style=\"color: #3366ff;\">case 0:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 0.0); \/\/ Play nothing<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 1:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 55.0); \/\/ Play A1<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 2:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 61.74); \/\/ Play B1<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 3:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 65.41); \/\/ Play C2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 4:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 73.42); \/\/ Play D2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 5:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 82.41); \/\/ Play E2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 6:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 87.31); \/\/ Play F2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 7:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 98.0); \/\/ Play G2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">case 8:<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.setFrequency(0, 110.0); \/\/ Play A2<\/span><br \/>\n<span style=\"color: #3366ff;\">edgar.trigger(0);<\/span><br \/>\n<span style=\"color: #3366ff;\">break;<\/span><br \/>\n<span style=\"color: #3366ff;\">}<\/span><br \/>\n<span style=\"color: #3366ff;\">}<\/span><\/p>\n<p>\u6700\u540e\uff0c\u6bcf\u4e2aArduino\u8349\u56fe\u90fd\u9700\u8981\u4e00\u4e2a\u5faa\u73af\u51fd\u6570\u3002\u4f46\u5b9e\u9645\u4e0a\u6211\u4eec\u6ca1\u6709\u9700\u8981\u5faa\u73af\u8fd0\u884c\u7684\u5de5\u4f5c\uff0c\u6240\u4ee5\u6211\u4eec\u53ea\u5728\u5176\u4e2d\u5199\u5165\u4e00\u4e2asleep\u51fd\u6570\u3002<br \/>\n<span style=\"color: #3366ff;\">void loop() {<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(10000);<\/span><br \/>\n<span style=\"color: #3366ff;\">}<\/span><\/p>\n<p>\u4fdd\u5b58\u8be5\u8349\u56fe\uff0c\u5e76\u5c06\u5176\u4e0a\u4f20\u5230\u60a8\u7684Arduino Uno\u3002<\/p>\n<h3>\u8fde\u63a5I2C\u603b\u7ebf<\/h3>\n<p>\u8fd9\u90e8\u5206\u5185\u5bb9\u4e0e\u6211\u4eec\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u6240\u4ecb\u7ecd\u7684\u5b8c\u5168\u76f8\u540c\uff1a\u5c06Raspberry Pi\u7684SDA\u5f15\u811a\u8fde\u63a5\u5230Arduino Uno\u7684A4\u5f15\u811a\uff0c\u5c06SCL\u5f15\u811a\u8fde\u63a5\u5230A5\u5f15\u811a\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10176\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17.png\" alt=\"\" width=\"1280\" height=\"871\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17.png 1280w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-300x204.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-1024x697.png 1024w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-768x523.png 768w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-215x146.png 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-50x34.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2021\/03\/synth17-110x75.png 110w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<h3>\u64ad\u653e\u4e00\u9996\u7b80\u5355\u7684\u6b4c\u66f2<\/h3>\n<p>\u73b0\u5728\u8ba9\u6211\u4eec\u7528\u8be5\u9879\u76ee\u6765\u64ad\u653e\u6b4c\u66f2\u300aMary Had a Little Lamb\u300b\u3002<br \/>\n\u8fd9\u9996\u6b4c\u6709\u4e24\u79cd\u4e0d\u540c\u957f\u5ea6\u7684\u97f3\u7b26\uff1a\u56db\u5206\u97f3\u7b26\u548c\u534a\u97f3\u7b26\uff08\u6216\u4e8c\u5206\u97f3\u7b26\uff09\u3002\u6211\u4eec\u73b0\u5728\u6765\u7f16\u5199\u4e24\u4e2a\u5feb\u901f\u51fd\u6570\u6765\u64ad\u653e\u8fd9\u4e9b\u97f3\u7b26\u3002<br \/>\n\u6211\u4eec\u9700\u8981\u8ba1\u65f6\u529f\u80fd\uff0c\u56e0\u6b64\u5728\u8fd9\u91cc\u5bfc\u5165sleep\u51fd\u6570\u3002<br \/>\n<span style=\"color: #3366ff;\">from time import sleep<\/span><\/p>\n<p>\u4f46\u662f\u4e2d\u95f4\u9700\u8981\u6682\u505c\u591a\u4e45\uff1f\u6211\u4eec\u7684\u6b4c\u66f2\u662f\u6bcf\u5206\u949f122\u62cd\u3002\u6839\u636e\u8be5\u6570\u503c\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u51fa\u6bcf\u4e2a\u97f3\u7b26\u9700\u8981\u591a\u5c11\u79d2\uff1a\u56db\u5206\u97f3\u7b26\u662f492\u5fae\u79d2\u3002\u6211\u4eec\u5728\u7ed3\u5c3e\u5904\u8bbe\u7f6e\u4e00\u6bb5\u975e\u5e38\u77ed\u7684\u6682\u505c\uff0c\u4ee5\u4fbf\u80fd\u591f\u5728\u64ad\u653e\u76f8\u540c\u97f3\u8c03\u65f6\u5206\u8fa8\u8fd9\u4e9b\u97f3\u7b26\u3002<br \/>\n<span style=\"color: #3366ff;\">def playCrotchet(int pitch):<\/span><br \/>\n<span style=\"color: #3366ff;\">i2cbus.write_byte(pitch)<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(0.472)<\/span><br \/>\n<span style=\"color: #3366ff;\">i2cbus.write_byte(arduino, 0)<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(0.02)<\/span><\/p>\n<p>\u73b0\u5728\u6211\u4eec\u6765\u5199\u4e00\u4e2a\u534a\u97f3\u7b26\u51fd\u6570\uff1a<\/p>\n<p><span style=\"color: #3366ff;\">def playMinim(int pitch):<\/span><br \/>\n<span style=\"color: #3366ff;\">i2cbus.write_byte(pitch)<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(0.964)<\/span><br \/>\n<span style=\"color: #3366ff;\">i2cbus.write_byte(arduino, 0)<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(0.02)<\/span><\/p>\n<p>\u7136\u540e\uff1a<\/p>\n<p><span style=\"color: #3366ff;\">def playMary():<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(C2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playMinim(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playMinim(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(G2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playMinim(G2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(C2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(E2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playCrotchet(D2)<\/span><br \/>\n<span style=\"color: #3366ff;\">playMinim(C2)<\/span><\/p>\n<p>\u60f3\u8981\u64ad\u653e\u8be5\u6b4c\u66f2\uff0c\u8bf7\u8f93\u5165\uff1a<\/p>\n<p><span style=\"color: #3366ff;\">playMary()<\/span><\/p>\n<p>\u591a\u5c1d\u8bd5\u4e00\u4e9b\u5185\u5bb9\uff0c\u770b\u770b\u6709\u6ca1\u6709\u4ec0\u4e48\u65b0\u7684\u60f3\u6cd5\u3002<\/p>\n<h3>\u4e0b\u4e00\u6b65\u8be5\u505a\u4ec0\u4e48\uff1f<\/h3>\n<p>\u8fd9\u662f\u63a2\u7d22\u5408\u6210\u5668\u6784\u5efa\u65b9\u6cd5\u7684\u4e00\u4e2a\u5f88\u597d\u7684\u5f00\u7aef\uff1a\u60a8\u8fd8\u53ef\u4ee5\u57fa\u4e8e\u8be5\u5185\u5bb9\u5236\u4f5c\u4e00\u4e9b\u5f88\u9177\u7684\u4f4e\u97f3\u7ebf\u3002<br \/>\n\u4f46\u662f\u5c06\u6240\u6709\u97f3\u4e50\u90fd\u5199\u6210\u4ee3\u7801\u662f\u76f8\u5f53\u9ebb\u70e6\u7684\uff0c\u800c\u4e14\u6211\u4eec\u76ee\u524d\u53ea\u6709\u6709\u9650\u7684\u97f3\u7b26\u548c\u7b80\u5355\u7684\u6ce2\u5f62\u3002<br \/>\n\u63a5\u4e0b\u6765\u5982\u679c\u53ef\u4ee5\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u4ee5\u53ca\u6539\u53d8\u97f3\u7b26\u7684\u97f3\u8272\u4e0d\u662f\u4f1a\u66f4\u597d\u4e48\uff1f<br \/>\n\u8bf7\u7ee7\u7eed\u5173\u6ce8\u6211\u4eec\u2014\u2014\u6211\u4eec\u5c06\u4f1a\u5f88\u5feb\u8fdb\u884c\u8fd9\u4e9b\u5185\u5bb9\u7684\u63a2\u7d22\u3002<\/p>\n<div class=\"author-box-wrapper\">\n<div class=\"avatar-wrapper\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/micro.wfjydl.com\/deviceplus\/wp-content\/uploads\/2018\/08\/Device-Plus-logo-for-author-info-75x75.png\" width=\"64\" height=\"64\" alt=\"DevicePlus \u7f16\u8f91\u56e2\u961f\">\n\t<\/div>\n<div class=\"desc-wrapper\">\n<h5>DevicePlus \u7f16\u8f91\u56e2\u961f<\/h5>\n<div class=\"desc\">\n<p>\u8bbe\u5907\u5347\u7ea7\u7248\u9002\u7528\u4e8e\u6240\u6709\u70ed\u7231\u7535\u5b50\u548c\u673a\u7535\u4e00\u4f53\u5316\u7684\u4eba\u3002<\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8eDevicePlus.com\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002 \u4e0d\u4e45\u524d\uff0c\u6211\u4eec\u7814\u7a76\u4e86\u5982\u4f55\u4f7f\u7528Raspberry Pi\u7684I2C\u603b\u7ebf\u6765\u63a7\u5236Arduino Uno\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u6765\u8f93\u51fa\u6a21\u62df\u7535\u538b\u3002 \u4ee4\u4eba\u5174\u594b\u7684\u662f\uff0c\u5b8c\u6210\u8fd9\u4e9b\u9879\u76ee\u540e\uff0c\u60a8\u5c31 [&hellip;]","protected":false},"author":4,"featured_media":17764,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1132],"tags":[],"class_list":["post-17763","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry"],"acf":[],"wps_subtitle":"","_links":{"self":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/17763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/comments?post=17763"}],"version-history":[{"count":3,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/17763\/revisions"}],"predecessor-version":[{"id":17783,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/17763\/revisions\/17783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media\/17764"}],"wp:attachment":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media?parent=17763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/categories?post=17763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/tags?post=17763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}