¥Û¡¼¥à > Arduino ¥»¥ó¥µ > Grove¶ÚÅÅ¥»¥ó¥µ_SeeedStudio
Grove¶ÚÅÅ¥»¥ó¥µ_SeeedStudio
5,500±ß(ÀÇ500±ß)
Grove¶ÚÅÅ¥»¥ó¥µ(Grove-EMG Detector)¤Ï¡¢¶ÚÆù¤Î¥·¥°¥Ê¥ë¤òÁýÉý¡¦¥Õ¥£¥ë¥¿¡¼½èÍý¤·¡¢Arduino¤Ç¼èÆÀ¤Ç¤¤ë¿®¹æ¤ò½ÐÎϤ·¤Þ¤¹¡£(Ãí¡§ËÜÀ½ÉʤϰåÎÅÌÜŪ¤Ç»ÈÍѤ¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£) ¥¹¥¿¥ó¥Ð¥¤¥â¡¼¥É¤Ç¤Ï¡¢½ÐÎÏÅÅ°µ¤Ï1.5V¤Ç¤¹¡£¶Ú³èÆ°¤ò¸¡ÃΤ·¤¿»þ¡¢½ÐÎÏ¿®¹æ¤¬¾å¾º¤·¤Þ¤¹¡£ºÇÂç½ÐÎϤÏ3.3V¤Ç¤¹¡£ËÜ¥»¥ó¥µ3.3V¤ä5V¤Ç»ÈÍѤ¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£ ¡ãGrove¶ÚÅÅ¥»¥ó¥µ¤Î¼ç¤ÊÆÃħ¡ä Grove¥â¥¸¥å¡¼¥ë 3.5Ð¥³¥Í¥¯¥¿ 6¤Ä¤ÎɽÌÌÅŶËÉÕ¤ »ÈÍÑÅÅ°µ¡§3.3V-5V 1¥á¡¼¥È¥ë¥±¡¼¥Ö¥ë ÄɲÃÅŸ»ÉÔÍ× ¡ãGrove¶ÚÅÅ¥»¥ó¥µ¤Î»ÈÍÑÊýË¡¡ä ¥Ç¥â¥³¡¼¥É¤Ï¡¢ÏÓ¤ËGrove¶ÚÅÅ¥»¥ó¥µ¤ò¼è¤êÉÕ¤±¡¢ÏӤζʤ²¤ËÈ¿±þ¤·¤ÆGrove LED¥Ð¡¼¤¬ÅÀÅô¤¹¤ë¥×¥í¥°¥é¥à¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¥Ç¥â¥³¡¼¥É¤ò½ñ¤¹þ¤ß½ª¤ï¤Ã¤¿¸å(¤â¤·¤¯¤ÏArduinoµ¯Æ°»þ)¡¢½é´ü²½¤ËÌó5Éäۤɤ«¤«¤ê¤Þ¤¹¡£½é´ü²½»þ¤ÏÆ°¤«¤º°ÂÄꤷ¤¿¾õÂÖ¤òÊݤäƤ¯¤À¤µ¤¤¡£½é´ü²½¤¬½ªÎ»¤·¤¿»þ¡¢Grove LED¥Ð¡¼¤Ï¥ì¥Ù¥ë10¤«¤é¥ì¥Ù¥ë0¤ËÊѲ½¤·¤Þ¤¹¡£Grove LED¥Ð¡¼¤¬¤¹¤Ù¤ÆOFF¤Ë¤Ê¤ì¤Ð¡¢ÏÓ¤òÆ°¤«¤·¡¢·×¬¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£ÏÓ¤ÎÆ°¤¤Ë¤è¤êLED¥Ð¡¼¤ÎÅÀÅô¥ì¤Ù¥ë¤¬ÊѲ½¤·¤Þ¤¹¡£ Grove LED¥Ð¡¼¤ò»ÈÍѤ¹¤ë¤¿¤á¤Î¡¢¥é¥¤¥Ö¥é¥ê¤Ï°Ê²¼¤Ë¤¢¤ê¤Þ¤¹¡£ https://github.com/Seeed-Studio/Grove_LED_Bar Grove¶ÚÅÅ¥»¥ó¥µ¤Ë¤Ä¤¤¤Æ¤ÎÄɲþðÊ󡦾ܺپðÊó¤Ï²¼µ¥Ú¡¼¥¸(±Ñ¸ì)¤ò¤´Í÷¤¯¤À¤µ¤¤¡£ http://www.seeedstudio.com/wiki/Grove_-_EMG_Detector ¡ãGrove¶ÚÅÅ¥»¥ó¥µ¤Î¥Ç¥â¥³¡¼¥É¡ä /*Grove¥Ù¡¼¥¹¥·¡¼¥ë¥É¤ò»ÈÍѤ·¡¢¶ÚÅÅ¥»¥ó¥µ¤ò¥¢¥Ê¥í¥°0ÈÖ¥Ô¥ó¤ËÀܳ¤·¡¢GroveLED¥Ð¡¼¤ò¥Ç¥¸¥¿¥ë8ÈÖ¡¦9ÈÖ¥Ô¥ó¤ËÀܳ¤·¤Þ¤¹¡£½é´ü²½¸å¡¢¶ÚÅŤËÂбþ¤·¡¢LED¥Ð¡¼¤¬ÅÀÅô¤·¤Þ¤¹¡£*/ #include <LED_Bar.h> //Grove LED¥Ð¡¼¤Î¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפǤ¹¡£ LED_Bar bar(9, 8); int max_analog_dta = 300; // max analog data int min_analog_dta = 100; // min analog data int static_analog_dta = 0; // static analog data // get analog value int getAnalog(int pin) { long sum = 0; for(int i=0; i<32; i++) { sum += analogRead(pin); } int dta = sum>>5; max_analog_dta = dta>max_analog_dta ? dta : max_analog_dta; // if max data min_analog_dta = min_analog_dta>dta ? dta : min_analog_dta; // if min data return sum>>5; } void setup() { Serial.begin(115200); long sum = 0; for(int i=0; i<=10; i++) { for(int j=0; j<100; j++) { sum += getAnalog(A0); delay(1); } bar.setLevel(10-i); } sum /= 1100; static_analog_dta = sum; Serial.print("static_analog_dta = "); Serial.println(static_analog_dta); } int level = 5; int level_buf = 5; void loop() { int val = getAnalog(A0); // get Analog value int level2; if(val>static_analog_dta) // larger than static_analog_dta { level2 = 5 + map(val, static_analog_dta, max_analog_dta, 0, 5); } Else { level2 = 5 - map(val, min_analog_dta, static_analog_dta, 0, 5); } // to smooth the change of led bar if(level2 > level) { level++; } else if(level2 < level) { level--; } if(level != level_buf) { level_buf = level; bar.setLevel(level); } delay(10); }