Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
RoboCircuits
Published © CC BY

Smart Lights for Google Home Mini

Make boring speaker Amazing

BeginnerFull instructions provided1 hour1,612
Smart Lights for Google Home Mini

Things used in this project

Story

Read more

Schematics

Circuit

The temperature sensor is microphone.

Code

Code

Arduino
// This code is designed by RoboCircuits
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif 

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        6 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 24 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:
  
  pinMode(A0,INPUT);
  Serial.begin(9600);
 #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
  
  // put your main code here, to run repeatedly:
  int a = analogRead(A0);
  Serial.println(a);
  int sensitivity = 320;
  int val_1 = map(a, 200, sensitivity+1, 0, NUMPIXELS);
pixels.clear();
  for(int i=-1; i<val_1; i++)
  {
    pixels.setPixelColor(i, pixels.Color(0, 0, 255));
    pixels.show();
  }
}

Credits

RoboCircuits

RoboCircuits

37 projects • 219 followers
YouTuber, Explorer, Creator, Programmer, Arduino Lover and Engineer

Comments