数字 kazaguruma digindmill
我做了一个数字的卡扎古鲁马 “digindmill”, 呼吸和旋转
麦克风呼吸, 感觉到声音, 并控制 led 的发射。
旋转速度会根据音量的不同而变化。
目次
配件一览
- Arduino Nano clone product
- High sensitivity MIC amplifier kit
- LED Tape Neopixel
生产过程
对羽毛使用100均匀的聚丙烯片
我用100人的皮科皮科锤子的东西来处理它:-)。
把它连接进去。
完成!
真漂亮!
arduino ide 代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
#include<Adafruit_NeoPixel.h></Adafruit_NeoPixel.h> #ifdef __AFR__ #include<avr ower.h=""></avr> #endif const int analoginpin = A1; int sensorvalue = 0; int amp = 0; int rotdelay = 500; int fin = 0; Kazaguruma Feather Hai led setting #define Numpixels 5 Adafruit_neopixel pixel0 = Adafruit_neopixel (Numpixels, 2, NEO_GRB + NEO_KHZ800); Adafruit_neopixel Pixel1 = Adafruit_neopixel (Numpixels, 3, NEO_GRB + NEO_KHZ800); Adafruit_neopixel Pixel2 = Adafruit_neopixel (Numpixels, 4, NEO_GRB + NEO_KHZ800); Adafruit_neopixel pixel3 = Adafruit_neopixel (Numpixels, 5, NEO_GRB + NEO_KHZ800); Adafruit_neopixel Pixel4 = Adafruit_neopixel (numpixels, 6, NEO_GRB + NEO_KHZ800); Adafruit_neopixel Pixel5 = Adafruit_neopixel (numpixels, 7, NEO_GRB + NEO_KHZ800); Adafruit_neopixel pixel6 = Adafruit_neopixel (Numpixels, 8, NEO_GRB + NEO_KHZ800); Adafruit_neopixel Pixel7 = Adafruit_neopixel (numpixels, 9, NEO_GRB + NEO_KHZ800); Adafruit_neopixel pixels [8] = {pixel0, pixel1, Pixel2, Pixel3, Pixel4, Pixel5, Pixel6, PIXEL7}; uint32_t fincolors [8]; void Setup () { Serial.begin (9600); #if defined (__avr_atiny85__) if (f_cpu = = 16 million) Clock_prescale_set (clock_div_1); #endif for (int i = 0; i< 8; i++ ){ 8;="" i++=""></ 8; i++ ){> pixels [i]. Begain (); pixels [i]. ssetrigness (20); } Feather Color Setting fincolors [0] = pixels [0]. Color (255, 0, 0); fincolors [1] = pixels [0]. Color (150150150); fincolors [2] = pixels [0]. Color (85, 0170); fincolors [3] = pixels [0]. Color (120155, 0); fincolors [4] = pixels [0]. Color (0, 0255); fincolors [5] = pixels [0]. Color (170, 0, 85); fincolors [6] = pixels [0]. Color (0255, 0); fincolors [7] = pixels [0]. Color (0170170); } void Loop () { Mic output averaging for (int i = 0; i< 10; i++){ 10;=""></ 10; i++){> Sensorvalue = + analogread (analoginpin); } Serial.print (Sensorvalue/10); Mic output bias Removal AMP = ABS (Sensorvalue/10-30); Serial.print (""); Serial.print (AMP); Rotational speed derivation from mic output Rotdelay = Map (AMP, 10, 60, 150, 0); if (rotdelay< 0){></ 0){> Rotdelay = 0; } Serial.print (""); Serial.println (Rotdelay); for (int j = 0; j< 8; j++){ 8;=""></ 8; j++){> int k = j + fin; if (k > = 8) { K = k-8; } for (int i = 0; i< 5; i++){ 5;=""></ 5; i++){> Pixels [j]......... (I, fincolors [K]); } } for (int i = 0; i< 8; i++ ){ 8;="" i++=""></ 8; i++ ){> pixels [i]. .show (); } Delay (15); The mic output is rotated at a certain level if (Amp > 10) { Delay (Rotdelay); Fin + +; if (Fin > = 8) { Fin = fin-8; } } for (int i = 0; i< 8; i++ ){ 8;="" i++=""></ 8; i++ ){> pixels [i]. .clear (); pixels [i]. .show (); } |
附加
我是在阿达果的官方网页上被介绍的!