// https://forum.arduino.cc/t/simple-clap-menorah-wiring-guide-arduino-uno/1416384/
#include <FastLED.h> // https://github.com/FastLED/FastLED
#define NUM_LEDS 45 // number of LEDs
#define DATA_PIN 4
#define LED_TYPE WS2812B // type
#define COLOR_ORDER GRB // color order (GRB, RGB, BGR)
#define BRIGHTNESS 255 // 0 - 255
#define BUTTON_PIN 2
CRGB led[NUM_LEDS];
#define BUTTON_PIN 2
int mode, modes = 4, currentButtonRead, lastButtonRead;
unsigned long timer, timeout = 100;
bool currentButtonState;
#define shamash 12 // center light
void setup() {
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(led, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear(); // LEDs off
FastLED.show(); // Update LEDs
led[shamash] = CRGB (255, 255, 255);
FastLED.show();
for (byte i = 0; i < NUM_LEDS; i++)
if (i % 3)
led[i] = CRGB (0, 0, 255);
else
led[i] = CRGB (0, 0, 0);
FastLED.show();
}
void loop() {
}
void diffuse(byte candle) { // white pixel flicker
byte i = random (63, 255);
led[candle] = CRGB(i, i, i);
FastLED.show();
delay(random(63, 255));
}
void filloil() { // before lighting, shamash, tonights candle, previous nights
}
void readButton() {
bool currentButtonRead = digitalRead(BUTTON_PIN); // read button pin
if (currentButtonRead != lastButtonRead) { // if button pin changes...
timer = millis(); // ...start a timer
lastButtonRead = currentButtonRead; // ... and store current state
}
if ((millis() - timer) > timeout) { // if button change was longer than debounce timeout
if (currentButtonState == HIGH && lastButtonRead == LOW) { // ... and State is "RELEASED" while Button Read is "PRESSED"
mode++; // advance the mode
if (mode > modes) // constrain the mode
mode = 0; // reset mode count
currentButtonState = currentButtonRead; // update button state
}
}
}
/*
1. Fill shamash with oil and light
2. Fill right-most candle with oil
3. Three brachot (prayers) and light candle
4. Extinguish candles end of evening
5. Step #1, fill second candle with oil
6. Two prayers, light newest candle to first candle, Step #4
7. Shamash, two prayers, 3, 2, 1, Step #6
*/
/* DREIDLE
# # # 10101 SHIN
# # # 10101
# # # 10101
# # # 10101
##### 11111
##### 01111 HEY
# 00001
# 00001
# # 10001
# # 10001
##### 01111 GIMEL
# 00001
# 00001
### 00111
# 00001
### 00111 NUN
# 00001
# 00001
# 00001
##### 11111
*/
/*
PAUSE = 0
DO_3 = 131
DO_D3 = 139
RE_3 = 147
RE_D3 = 156
MI_3 = 165
FA_3 = 175
FA_D3 = 185
SOL_3 = 196
SOL_D3 = 208
LA_3 = 220
LA_D3 = 233
SI_3 = 247
DO_4 = 262
DO_D4 = 277
RE_4 = 294
RE_D4 = 311
MI_4 = 330
FA_4 = 349
FA_D4 = 370
SOL_4 = 392
SOL_D4 = 415
LA_4 = 440
LA_D4 = 466
SI_4 = 494
DO_5 = 523
DO_D5 = 554
RE_5 = 587
RE_D5 = 622
MI_5 = 659
FA_5 = 698
FA_D5 = 740
SOL_5 = 784
SOL_D5 = 831
LA_5 = 880
LA_D5 = 932
SI_5 = 988
maoz_tzur_melody = [
DO_4, SOL_3, DO_4, FA_4, MI_4, RE_4, DO_4, SOL_4,
SOL_4, LA_4, RE_4, MI_4, FA_4, MI_4, RE_4, DO_4, DO_4,
DO_4, SOL_3, DO_4, FA_4, MI_4, RE_4, DO_4, SOL_4,
SOL_4, LA_4, RE_4, MI_4, FA_4, MI_4, RE_4, DO_4,
SOL_4, SOL_4, LA_4, SI_4, DO_5, SOL_4,
DO_5, SI_4, LA_4, SOL_4, SOL_4, FA_4, MI_4, FA_4, RE_4,
MI_4, FA_4, SOL_4, LA_4, RE_4, MI_4, FA_4,
MI_4, DO_4, LA_4, SOL_4, FA_4, MI_4, FA_4, SOL_4,
MI_4, FA_4, SOL_4, LA_4, RE_4, MI_4, FA_4,
MI_4, DO_4, LA_4, SOL_4, FA_4, MI_4, RE_4, DO_4]
maoz_tzur_tempo = [
4, 4, 4, 4, 4, 4, 3, 8,
4, 4, 4, 8, 8, 4, 4, 3, 8,
4, 4, 4, 4, 4, 4, 3, 8,
4, 4, 4, 8, 8, 4, 4, 2,
3, 8, 4, 4, 2, 2,
4, 4, 4, 4, 8, 8, 8, 8, 2,
3, 8, 3, 8, 3, 8, 2,
4, 4, 4, 8, 8, 4, 4, 2,
3, 8, 3, 8, 3, 8, 2,
4, 4, 4, 8, 8, 4, 4, 2]
hanerot_halalu_melody = [
MI_4, MI_4, MI_4, MI_4, MI_4, MI_4, MI_4,
MI_4, RE_4, DO_4, RE_4, MI_4, DO_4, SOL_4,
SOL_4, SOL_4, SOL_4, SOL_4, SOL_4, SOL_4,
SOL_4, FA_4, MI_4, FA_4, SOL_4, MI_4,
SOL_4, DO_5, MI_4, FA_4, SOL_4, SOL_4,
SOL_4, DO_5, MI_4, FA_4, SOL_4,
LA_4, SOL_4, FA_4, MI_4, RE_4, SOL_4,
MI_4, MI_4, RE_4, RE_4, DO_4,
MI_4, MI_4, MI_4, MI_4,
MI_4, RE_4, DO_4, RE_4, MI_4, DO_4,
SOL_4, SOL_4, SOL_4, SOL_4,
SOL_4, FA_4, MI_4, FA_4, SOL_4, MI_4,
SOL_4, DO_5, MI_4, FA_4, SOL_4,
SOL_4, DO_5, MI_4, FA_4, SOL_4,
LA_4, SOL_4, FA_4, MI_4, RE_4, SOL_4,
MI_4, RE_4, DO_4]
hanerot_halalu_tempo = [
8, 4, 6, 16, 4, 6, 16,
8, 8, 8, 8, 4, 8, 8,
4, 6, 16, 4, 6, 16,
8, 8, 8, 8, 4, 4,
8, 8, 8, 8, 3, 8,
8, 8, 8, 8, 2,
8, 8, 8, 8, 4, 4,
8, 8, 8, 8, 2,
4, 4, 4, 4,
8, 8, 8, 8, 4, 4,
4, 4, 4, 4,
8, 8, 8, 8, 4, 4,
8, 8, 8, 8, 2,
8, 8, 8, 8, 2,
8, 8, 8, 8, 4, 4,
4, 4, 3]
*/1000uf
E-cap