/************************************************************ * Fabricademy FP ************************************************************/ // NeoPixel #include #define PIN D3// Neopixel pin #define NUMPIXELS 1 // Number of NeoPixels Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); //Speaker #define spPin D1// //int mScale[]={131,165,196,262,330,392,523,659,784,1047}; //C#3, E#3, G#3, --- //int mScale[]={277,311,329,391,440}; //C#4, D#4, E#4, G#4, A#4) int mScale[]={1046,1174,1318,1567,1760}; //C#6, D#6, E#6, G#6, A#6) //BioMetal #define amPin2 D0// bool isAmOn=false; int spVal=0; int mode=0; unsigned long timCnt=0; bool isLED = true; int ledBr = 100; int colR=255, colG=105, colB=180; int br=2; void setup() { //NeoPixel setup pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.clear(); // Set all pixel colors to 'off' Serial.begin(9600); } void loop() { switch(mode){ case 0: chkFerment(); break; case 1: break; case 2: break; } if(isAmOn){ analogWrite(amPin2, random(240,255)); Serial.println(" ******AMON"); }else{ analogWrite(amPin2, 0); Serial.println(" AMoff"); } delay(5); // delay(5009); isAmOn = !isAmOn; } void chkFerment(){ dspLed(); randomTone(); // //spOut(int(0)); } void dspLed(){ if(isLED){ // The first NeoPixel in a strand is #0, second is 1, all the way up // to the count of pixels minus one. for (int i = 0; i < NUMPIXELS; i++) { // For each pixel... // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(255, 105, ledBr)); //pixels.setPixelColor(i, pixels.Color(255, 185, 50)); pixels.setBrightness(ledBr); pixels.show(); // Send the updated pixel colors to the hardware. } ledBr += br; if(ledBr<5){ br=4;} else if(ledBr >250){ br=-4;} Serial.println(ledBr); //colB=ledBr; //spOut(spVal); //spVal == 9 ? spVal=0 : spVal++ ; }else{ pixels.clear(); // Set all pixel colors to 'off' pixels.show(); } } void randomTone(){ // tone(spPin, mScale[random(sizeof(mScale)-1)], random(10,150)); // tone(spPin, mScale[random(sizeof(mScale)-1)], random(100,150)); // Serial.println("spout"); } void spOut(int(val)){ //tone(spPin, val, 500); // //int a = map (val, 220, 350, 0,10); //int a = map (val, micBase, 350, 0,10); tone(spPin, mScale[val], 500); // }