Bought some big buttons from Adafruit, Red and Blue – (https://www.adafruit.com/product/1192)
bought an arduino micro (finally – after a Nano and ESP8266 NodeMCU)
Like this one but from ebay (https://www.amazon.co.uk/KOOKYE-ATmega32U4-arduino-Leonardo-ATmega328/dp/B019SXN84E/ref=sr_1_4?ie=UTF8&qid=1523834104&sr=8-4&keywords=arduino+micro)
Bought a 5v buzzer (https://www.adafruit.com/product/1536)
And finally some WS2812B with Buzzer but I removed the buzzer as I had a louder one above.
like this one but from ebay (https://www.amazon.co.uk/Paleo-WS2812B-Buzzer-Skyline-Controller/dp/B01IA5JY58)
I cobbled together some blocks for the buttons and another block for lights and sound. (picture below)
Wired them together as per the schematic below
And then used the following code.
#include #define PIN 6 // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, PIN, NEO_GRB + NEO_KHZ800); const int buttonPinB = 4; // the number of the Blue pushbutton pin const int buttonPinR = 5; // the number of the Red pushbutton pin const int buzzer = 9; //buzzer to arduino pin 9 int buttonStateB = 0; // variable for reading the pushbutton status int buttonStateR = 0; // variable for reading the pushbutton status void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' pinMode(buttonPinB, INPUT); pinMode(buttonPinR, INPUT); pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output } void loop() { // read the state of the Blue pushbutton value: buttonStateB = digitalRead(buttonPinB); // check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonStateB == HIGH) { colorWipeR(strip.Color(0, 0, 255), 50); // Blue colorWipeR(strip.Color(0, 0, 0), 50); // Black delay(1000); } buttonStateR = digitalRead(buttonPinR); // check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonStateR == HIGH) { // turn LED on: colorWipe(strip.Color(255, 0, 0), 50); // Red colorWipe(strip.Color(0, 0, 0), 50); // Black delay(1000); } } // Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(5-i, c); tone(buzzer, 1000); strip.show(); delay(wait); } noTone(buzzer); } // Fill the dots one after the other with a color void colorWipeR(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); tone(buzzer, 1000); strip.show(); delay(wait/2); noTone(buzzer); delay(wait/2); } }