Do you have any suggestions on what I should add as a feature? I currently have a flashlight, a full-color wipe, a global flashlight, an SOS, random colors, and a nightlight. There are currently 28 open functions.
interstellar sparkle, black hole breath
ChatGPT seems to understand what you are talking about:
"It sounds like you have a great start with your Command Block project! Here are some suggestions for additional features you could consider adding:
-
Color Transition Effects: Implement smooth transitions between colors instead of sudden changes. This could include fade in/out, crossfade, or rainbow effects.
-
Music Sync: Create a feature that allows the lighting to sync with music or audio. This could involve changing colors or patterns based on the beat or frequency of the sound.
-
Timer Functions: Add a timer for the flashlight or nightlight, allowing it to automatically turn off after a set period.
-
Ambient Modes: Introduce different ambient lighting modes, such as candle flicker, firelight, or soft sunset.
-
Remote Control/Voice Commands: If feasible, add functionality for remote control or voice command integration, allowing users to control the lighting features hands-free.
-
Mood Lighting Profiles: Create customizable profiles for different moods or activities (e.g., reading, party, relaxation) that users can quickly switch between.
-
Motion Detection: Implement motion detection to automatically turn on the flashlight or nightlight when someone enters the room.
-
Customizable Colors: Allow users to set and save their favorite colors or patterns for quick access.
-
Notifications: Use specific colors or patterns to indicate notifications or alerts (like reminders or messages) from other devices.
-
Integration with Smart Home Systems: If you want to take it a step further, consider compatibility with smart home systems, allowing users to control the lights through those platforms.
Feel free to mix and match these ideas based on your target audience and project goals!"
Personally, I have no idea. Maybe some background, context, and an explanation??
That sounds very interesting, what would that look like?
Also, the quantum mechanics are still experimental, but I'll keep it in mind.
All of them look great! I'll see what I can do to add them. I also have a few ideas too.
Currently, the command Block is an experiment with code for the real thing. It has many different things it can do. I've used it as a flashlight and a lantern at a camp. Plus it serves as a great nightlight.
If anyone is interested in the Command Block's code, or if you want to give any suggestions, I have the code available here;
#include <Adafruit_NeoPixel.h>
#define RAINBOWSPEED 1 // the larger the number, the slower the rate of change (1 default)
#define LED_PIN 13 // Pin where the LED strip is connected
#define NUM_LEDS 36 // Number of LEDs in the strip
#define LIGHTCHANGESPEED 1 // the larger the number, the slower the rate of change (1 default)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
bool reset_on_exit = false;
const int buttonPin = 11; // Pin where the button is connected
const int Relay_enable_IALS_input = 12; // Pin where the Relay is connected
bool ledState = false; // holds the state of the LED
int speaker_pin1 = 10;
int speaker_pin2 = 8;
int cur_pos = 13;
int rst_pin = 9;
int changeonconstant = 200;
void setup() {
digitalWrite(9, HIGH);
pinMode(rst_pin, OUTPUT);
digitalWrite(speaker_pin1, HIGH);
Serial.begin(9600);
strip.begin(); // Initialize the strip
pinMode(speaker_pin1, OUTPUT);
pinMode(speaker_pin2, OUTPUT); // Initialize all pixels to 'off'
pinMode(buttonPin, INPUT); // Set the button pin as an input
pinMode(Relay_enable_IALS_input, OUTPUT); // Set the Relay_enable_IALS_input as an output
digitalWrite(Relay_enable_IALS_input, ledState); // Initialize the relay state 255 * (1 / 100)
delay(100);
//colorWipe(0, 0, 0, 0, false);
strip.show();
}
int action = 0;
bool action_deleteCurSprite = true;
void loop() {
if (action > 0 && action_deleteCurSprite == true) {
strip.setPixelColor(cur_pos, 0, 0, 0);
strip.show();
action_deleteCurSprite = false;
} else if (action == 0) {
action_deleteCurSprite = true;
}
initiative();
reset();
buttonpanelRead();
stop(0);
actionAray();
}
// Fill the dots one after the other with a color
bool selector = true;
float potVal = analogRead(0); // stores the input from the potentiometer
float brightness = potVal / 1000;
bool lastButtonState = LOW; // holds the last button state
bool pause = false;
float timer = 0;
bool timerEnabled = false;
void button_sequence() {
if (timerEnabled == true) {
timer = timer - 0.001;
// Serial.println(timer);
if (timer <= 0 && timerEnabled == true) {
action = 0;
timerEnabled = false;
pause = true;
delay(300);
// Serial.println("action completed");
for (int oe = 0; oe < 37; oe++) {
strip.setPixelColor(oe, 0, 0, 0);
strip.show();
}
selector = true;
cur_pos = 13;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
}
}
bool buttonState = digitalRead(buttonPin);
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
ledState = !ledState;
digitalWrite(Relay_enable_IALS_input, ledState);
}
delay(50);
}
lastButtonState = buttonState;
}
int button_left = 4;
int button_right = 5;
int button_up = 7;
int button_down = 6;
int button_ok = 3;
int button_back = 2;
void actionAray() {
if (action == 1) {
runAction_Interstellar_sparkle_Black_Hole_Breath();
} else if (action == 2) {
runAction_2();
} else if (action == 3) {
runAction_3();
} else if (action == 4) {
runAction_4();
} else if (action == 5) {
runAction_5();
} else if (action == 6) {
runAction_6();
} else if (action == 7) {
runAction_7();
} else if (action == 8) {
runAction_8();
} else if (action == 9) {
runAction_18();
} else if (action == 10) {
runAction_defaultColorpattern();
} else if (action == 11) {
runAction_flashlight();
} else if (action == 12) {
runAction_globalflashlight();
} else if (action == 13) {
runAction_speaker();
} else if (action == 14) {
runAction_13();
} else if (action == 15) {
runAction_14();
} else if (action == 16) {
runAction_lowpowerconsumption();
} else if (action == 17) {
runAction_16();
} else if (action == 18) {
runAction_SOS();
} else if (action == 19) {
runAction_19();
} else if (action == 20) {
runAction_20();
} else if (action == 21) {
runAction_21();
} else if (action == 22) {
runAction_22();
} else if (action == 23) {
runAction_23();
} else if (action == 24) {
runAction_24();
} else if (action == 25) {
runAction_25();
} else if (action == 26) {
runAction_26();
} else if (action == 27) {
runAction_27();
} else if (action == 28) {
runAction_28();
} else if (action == 29) {
runAction_29();
} else if (action == 30) {
runAction_30();
} else if (action == 31) {
runAction_31();
} else if (action == 32) {
runAction_32();
} else if (action == 33) {
runAction_33();
} else if (action == 34) {
runAction_34();
} else if (action == 35) {
runAction_35();
} else if (action == 36) {
runAction_36();
}
}
int wait = 0;
int Delay_between_colorWipe_cycle = 0;
int r = 255;
int g = 255;
int b = 255;
int cnt = 0;
int cnt2 = 1;
void runAction_Interstellar_sparkle_Black_Hole_Breath() {
for (int iz = 0; iz < 10; iz++) {
colorWipe(iz, 0, iz * 4, 0, false);
}
for (int iz = 10; iz > 0; iz--) {
randomcolorWipe(iz, 0, iz*4, 0, false);
}
}
void runAction_2() {
}
void runAction_3() {
}
void runAction_4() {
}
void runAction_5() {
}
void runAction_6() {
}
void runAction_7() {
}
void runAction_8() {
}
// normal rainbow pattern
void runAction_defaultColorpattern() {
if (wait == 0) {
wait = 10;
while (action == 10) {
colorWipe(0, 0, 0, 0, true);
colorWipe(255 * brightness, 0 * brightness, 0 * brightness, LIGHTCHANGESPEED * 50, true); // Red color
delay(Delay_between_colorWipe_cycle);
colorWipe(255 * brightness, 100 * brightness, 0 * brightness, LIGHTCHANGESPEED * 50, true); // Orange color
delay(Delay_between_colorWipe_cycle);
colorWipe(255 * brightness, 200 * brightness, 0 * brightness, LIGHTCHANGESPEED * 50, true); // Yellow color
delay(Delay_between_colorWipe_cycle);
colorWipe(100 * brightness, 255 * brightness, 0 * brightness, LIGHTCHANGESPEED * 50, true); // Lime color
delay(Delay_between_colorWipe_cycle);
colorWipe(0 * brightness, 255 * brightness, 0 * brightness, LIGHTCHANGESPEED * 50, true); // Green color
delay(Delay_between_colorWipe_cycle);
colorWipe(0 * brightness, 255 * brightness, 50 * brightness, LIGHTCHANGESPEED * 50, true); // Turquoise color
delay(Delay_between_colorWipe_cycle);
colorWipe(0 * brightness, 255 * brightness, 255 * brightness, LIGHTCHANGESPEED * 50, true); // Cyan color
delay(Delay_between_colorWipe_cycle);
colorWipe(0 * brightness, 100 * brightness, 255 * brightness, LIGHTCHANGESPEED * 50, true); // Light Blue color
delay(Delay_between_colorWipe_cycle);
colorWipe(0 * brightness, 0 * brightness, 255 * brightness, LIGHTCHANGESPEED * 50, true); // Blue color
delay(Delay_between_colorWipe_cycle);
colorWipe(120 * brightness, 0 * brightness, 255 * brightness, LIGHTCHANGESPEED * 50, true); // Purple color
delay(Delay_between_colorWipe_cycle);
colorWipe(255 * brightness, 0 * brightness, 200 * brightness, LIGHTCHANGESPEED * 50, true); // Magenta color
delay(Delay_between_colorWipe_cycle);
colorWipe(255 * brightness, 255 * brightness, 255 * brightness, LIGHTCHANGESPEED * 50, true); // No color shift
delay(Delay_between_colorWipe_cycle);
double lumn_temp = brightness;
r = 255;
g = 255;
b = 255;
cnt = 0;
cnt2 = 1;
striprainbowGenerator(200, 1, brightness, 0, 37); // Rainbow effect speed
}
wait = 0;
}
colorWipe(0, 0, 0, 0, true);
strip.setPixelColor(cur_pos, 255, 0, 255);
}
// front flashlight
float brightness_mem = brightness;
bool repeater = false;
int waitonfirstactivation1 = 100;
void runAction_flashlight() {
bool wait = true;
primeBrightness();
if (repeater == false || round(brightness_mem * 20) != round(brightness * 20)) {
if (digitalRead(button_ok) == LOW) {
wait = true;
} else {
wait = false;
}
if (wait == true) {
// Serial.println(brightness_mem);
// Serial.println(brightness);
repeater = true;
brightness_mem = brightness;
for (int i = 1; i < 10; i++) {
strip.setPixelColor(i + 8, r * brightness, g * brightness, b * brightness);
strip.show();
}
}
}
if (digitalRead(button_right) == HIGH) {
repeater = false;
striprainbowGenerator(100, 0, brightness, 1, 0);
} else if (digitalRead(button_back) == HIGH) {
if (reset_on_exit == true) {
cnt2 = 1;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (repeater == true) {
strip.setPixelColor(cur_pos, r * brightness, g * brightness, b * brightness);
strip.show();
}
}
// global flashlight
void runAction_globalflashlight() {
bool wait = true;
primeBrightness();
if (repeater == false || round(brightness_mem * 20) != round(brightness * 20)) {
if (digitalRead(button_ok) == LOW) {
wait = true;
} else {
wait = false;
}
if (wait == true) {
// Serial.println(brightness_mem);
// Serial.println(brightness);
repeater = true;
brightness_mem = brightness;
colorWipe(r * brightness, g * brightness, b * brightness, 0, true);
}
}
if (digitalRead(button_right) == HIGH) {
repeater = false;
striprainbowGenerator(100, 0, brightness, 0, 0);
} else if (digitalRead(button_back) == HIGH) {
if (reset_on_exit == true) {
cnt2 = 1;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (repeater == true) {
strip.setPixelColor(cur_pos, r * brightness, g * brightness, b * brightness);
strip.show();
}
}
void runAction_speaker() {
uint64_t myInts[] = { 200, 400, 800, 16, 1000, 1000 }; // audio input here delayed by 300 ms
Serial.println();
int deltym = 300;
for (int ds = 0; ds < sizeof(myInts) / 8; ds++) {
if (selector == false) {
tone(speaker_pin1, myInts[ds], deltym);
stop(deltym);
}
}
}
void runAction_13() {
random_ColorGenerator();
stop(0);
}
double SubDelay = 0;
// sleep length is equivalent to the minnuts it takes to auto power off. 5 min is default
float sleep_length = 5;
int sleep_color = 1;
int setting = 0;
void runAction_14() {
while (digitalRead(button_ok) == HIGH) {
delay(1);
}
if (repeater == false) {
if (digitalRead(button_left) == HIGH && setting < 1) {
setting = setting + 1;
colorWipe(0, 0, 0, 0, false);
delay(changeonconstant);
}
if (digitalRead(button_right) == HIGH && setting > 0) {
setting = setting - 1;
colorWipe(0, 0, 0, 0, false);
delay(changeonconstant);
}
// 3 modes/lengths that play music, and show a peaceful lighting
if (setting == 0) {
if (digitalRead(button_up) == HIGH && sleep_length < 36) {
delay(changeonconstant);
sleep_length = sleep_length + 1;
} else if (digitalRead(button_down) == HIGH && sleep_length > 1) {
delay(changeonconstant);
sleep_length = sleep_length - 1;
}
for (int px = 0; px < sleep_length; px++) {
if (sleep_color == 1) {
strip.setPixelColor(px, 30, 5, 1);
} else if (sleep_color == 2) {
strip.setPixelColor(px, 5, 30, 5);
} else if (sleep_color == 3) {
strip.setPixelColor(px, 1, 5, 30);
}
strip.setPixelColor(px + 1, 0, 0, 0);
strip.show();
}
}
if (digitalRead(button_ok) == LOW && setting == 1) {
if (digitalRead(button_up) == HIGH && sleep_color < 3) {
delay(300);
sleep_color = sleep_color + 1;
} else if (digitalRead(button_down) == HIGH && sleep_color > 1) {
delay(300);
sleep_color = sleep_color - 1;
}
if (sleep_color == 1) {
strip.setPixelColor(10, 0, 0, 0);
strip.setPixelColor(13, 0, 0, 0);
strip.setPixelColor(16, 255, 0, 0);
strip.show();
} else if (sleep_color == 2) {
strip.setPixelColor(10, 0, 0, 0);
strip.setPixelColor(13, 255, 255, 0);
strip.setPixelColor(16, 255, 0, 0);
strip.show();
} else if (sleep_color == 3) {
strip.setPixelColor(10, 0, 0, 255);
strip.setPixelColor(13, 255, 255, 0);
strip.setPixelColor(16, 255, 0, 0);
strip.show();
}
}
SubDelay = sleep_length * 6000;
delay(50);
if (digitalRead(button_ok) == HIGH) {
if (sleep_color == 1) {
repeater = true;
// sleep 2 minuts
while (SubDelay > 0) {
if (digitalRead(button_back) == HIGH) {
SubDelay = 0;
action = 0;
stop(0);
} else {
for (int p = 0; p < 37; p++) {
strip.setPixelColor(p, random(30), random(4), random(1));
strip.show();
}
delay(1);
SubDelay = SubDelay - 5;
// Serial.println(SubDelay);
}
}
exit();
} else if (sleep_color == 2) {
repeater = true;
// sleep 5 minuts
while (SubDelay > 0) {
if (digitalRead(button_back) == HIGH) {
SubDelay = 0;
action = 0;
stop(0);
} else {
for (int p = 0; p < 37; p++) {
strip.setPixelColor(p, random(30), random(30), random(4));
strip.show();
}
delay(1);
SubDelay = SubDelay - 5;
// Serial.println(SubDelay);
}
}
exit();
} else if (sleep_color == 3) {
repeater = true;
// sleep 10 minuts
while (SubDelay > 0) {
if (digitalRead(button_back) == HIGH) {
SubDelay = 0;
action = 0;
stop(0);
} else {
for (int p = 0; p < 37; p++) {
strip.setPixelColor(p, random(1), random(10), random(30));
strip.show();
}
delay(1);
SubDelay = SubDelay - 5;
// Serial.println(SubDelay);
}
}
exit();
}
}
}
}
void runAction_lowpowerconsumption() {
int wait3 = true;
if (digitalRead(button_ok) == LOW) {
wait3 = false;
}
if (digitalRead(button_up) == HIGH && timer < 37) {
timer = timer + 1;
for (int pixletimer_num = 0; pixletimer_num < timer; pixletimer_num++) {
// Serial.println(timer);
strip.setPixelColor(pixletimer_num, 255, 255, 255);
strip.show();
}
} else if (digitalRead(button_down) == HIGH && timer >= 0) {
// Serial.println(timer);
strip.setPixelColor(timer, 0, 0, 0);
strip.show();
timer = timer - 1;
}
delay(150);
if (wait3 == false && digitalRead(button_ok) == HIGH) {
action = 0;
if (selector == false) {
repeater = false;
cur_pos = 13;
delay(300);
colorWipe(0, 0, 0, 0, true);
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
selector = true;
timerEnabled = true;
}
}
}
void runAction_16() {
if (repeater == false) {
repeater = true;
colorWipe(0, 0, 0, 0, true); // No color shift
}
}
// SOS
void runAction_SOS() {
if (wait == 0) {
wait = 18;
while (action == 17) {
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 3, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 3, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 5, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 20, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 1, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 20, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 1, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 20, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 5, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 3, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 3, true);
colorWipe(255, 255, 25, 0, true);
colorWipe(255, 255, 25, 2, true);
colorWipe(0, 0, 0, 0, true);
colorWipe(0, 0, 0, 40, true);
}
wait = 0;
}
}
void runAction_18() {
}
void runAction_19() {
}
void runAction_20() {
}
void runAction_21() {
}
void runAction_22() {
}
void runAction_23() {
}
void runAction_24() {
}
void runAction_25() {
}
void runAction_26() {
}
void runAction_27() {
}
void runAction_28() {
}
void runAction_29() {
}
void runAction_30() {
}
void runAction_31() {
}
void runAction_32() {
}
void runAction_33() {
}
void runAction_34() {
}
void runAction_35() {
}
void runAction_36() {
}
void testcolor() {
if (cur_pos == 9) {
strip.setPixelColor(cur_pos, 255, 100, 100);
strip.show();
} else if (cur_pos == 10) {
strip.setPixelColor(cur_pos, 255, 100, 255);
strip.show();
} else if (cur_pos == 11) {
strip.setPixelColor(cur_pos, 255, 255, 255);
strip.show();
} else if (cur_pos == 12) {
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
} else if (cur_pos == 13) {
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
} else if (cur_pos == 14) {
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
} else if (cur_pos == 15) {
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
} else if (cur_pos == 16) {
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
} else if (cur_pos == 17) {
strip.setPixelColor(cur_pos, 255, 255, 0);
strip.show();
}
}
bool Initializer = false;
void initiative() {
if (Initializer == true) {
delay(1050);
for (int j = 0; j < 256; j++) {
for (int i = 0; i < 37; i++) {
strip.setPixelColor(i, 0, j, j);
strip.show();
}
}
for (int i = 0; i < 37; i++) {
strip.setPixelColor(i, 0, 0, 0);
strip.show();
}
for (int o = 0; o < 10; o++) {
for (int i = -1; i < 37; i++) {
int xp = i - 18;
if (xp < 0) {
xp = 37 + xp;
strip.setPixelColor(i, 0, 255, 255);
strip.show();
delay(20);
strip.setPixelColor(xp, 0, 50, 255);
strip.show();
delay(20);
} else {
strip.setPixelColor(i, 0, 255, 255);
strip.show();
delay(20);
strip.setPixelColor(xp, 0, 50, 255);
strip.show();
delay(20);
}
}
}
for (int h = 1; h < 4; h++) {
delay(100);
for (int hi = 0; hi < 8; hi++) {
for (int i = 0; i < 37; i++) {
strip.setPixelColor(i, 0, hi * 32, 255);
strip.show();
}
delay(1);
}
}
for (int i = 0; i < 37; i++) {
strip.setPixelColor(i, 0, 0, 0);
strip.show();
}
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
strip.show();
Initializer = false;
}
}
int cur_save;
void buttonpanelRead() {
float timer1 = 0;
if (selector == true) {
reset();
if (digitalRead(button_up) == HIGH) {
cur_save = cur_pos;
if (cur_pos >= 3 && cur_pos <= 8 || cur_pos >= 12 && cur_pos <= 17 || cur_pos >= 21 && cur_pos <= 26 || cur_pos >= 30 && cur_pos <= 35) {
cur_pos = cur_pos - 3;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
}
} else if (digitalRead(button_down) == HIGH) {
cur_save = cur_pos;
if (cur_pos >= 0 && cur_pos <= 5 || cur_pos >= 9 && cur_pos <= 14 || cur_pos >= 18 && cur_pos <= 23 || cur_pos >= 27 && cur_pos <= 32) {
cur_pos = cur_pos + 3;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
}
} else if (digitalRead(button_right) == HIGH) {
cur_save = cur_pos;
if (cur_pos == 2 || cur_pos == 5 || cur_pos == 8 || cur_pos == 11 || cur_pos == 14 || cur_pos == 17 || cur_pos == 20 || cur_pos == 23 || cur_pos == 26) {
cur_pos = cur_pos + 7;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
} else if (cur_pos == 29 || cur_pos == 32 || cur_pos == 35) {
cur_pos = cur_pos - 29;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
} else {
cur_pos = cur_pos + 1;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
}
} else if (digitalRead(button_left) == HIGH) {
cur_save = cur_pos;
if (cur_pos == 9 || cur_pos == 12 || cur_pos == 15 || cur_pos == 18 || cur_pos == 21 || cur_pos == 24 || cur_pos == 27 || cur_pos == 30 || cur_pos == 33) {
cur_pos = cur_pos - 7;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
} else if (cur_pos == 0 || cur_pos == 3 || cur_pos == 6) {
cur_pos = cur_pos + 29;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
} else {
cur_pos = cur_pos - 1;
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.setPixelColor(cur_save, 0, 0, 0);
strip.show();
delay(changeonconstant);
testcolor();
}
}
action = 0;
repeater = false;
if (digitalRead(button_ok) == HIGH) {
for (int hqi = 0; hqi < 36; hqi++) {
if (cur_pos == hqi) {
action = hqi + 1;
delay(100);
selector = false;
}
}
delay(10);
repeater = false;
}
while (digitalRead(button_up) == LOW && digitalRead(button_down) == LOW && digitalRead(button_left) == LOW && digitalRead(button_right) == LOW && digitalRead(button_ok) == LOW && digitalRead(button_back) == LOW) {
if (timer1 != 70100) {
timer1 = timer1 + 1;
if (timer1 == 50000) {
strip.setPixelColor(cur_pos, 50, 0, 50);
strip.show();
}
if (timer1 >= 70000) {
strip.setPixelColor(cur_pos, 0, 0, 0);
strip.show();
}
}
}
}
}
void striprainbowGenerator(int wait, bool loop, float brightness_v3, int pixle_number_start, int pixle_number_end) {
if (loop == 1) {
for (int ax = 0; ax <= 88; ax++) {
if (selector == false) {
if (r == 255 && g == 255 && b == 255) {
r = 255;
g = 0;
b = 0;
}
if (cnt2 == 1) {
g = g + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 2;
cnt = 0;
r = 255;
g = 255;
b = 0;
}
}
if (cnt2 == 2) {
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 3;
cnt = 0;
r = 0;
g = 255;
b = 0;
}
}
if (cnt2 == 3) {
b = b + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
r = 0;
g = 255;
b = 255;
cnt2 = 4;
cnt = 0;
}
}
if (cnt2 == 4) {
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 5;
cnt = 0;
r = 0;
g = 0;
b = 255;
}
}
if (cnt2 == 5) {
r = r + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 6;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 6) {
g = g - 31.875;
b = b - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 7;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 7) {
b = b - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 8;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 8) {
b = b - 31.875;
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 9;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 9) {
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 10;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 10) {
r = r - 31.875;
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 11;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 11) {
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 1;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
for (int pxn = pixle_number_start; pxn <= pixle_number_end; pxn++) {
if (selector == false) {
primeBrightness();
brightness_v3 = brightness;
strip.setPixelColor(pxn, r * brightness_v3, g * brightness_v3, b * brightness_v3);
strip.show();
}
}
} else {
cnt = 0;
cnt2 = 1;
r = 255;
g = 255;
b = 255;
}
}
} else if (loop == 0) {
if (r == 255 && g == 255 && b == 255) {
r = 255;
g = 0;
b = 0;
}
primeBrightness();
if (cnt2 == 1) {
g = g + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 2;
cnt = 0;
r = 255;
g = 255;
b = 0;
}
}
if (cnt2 == 2) {
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 3;
cnt = 0;
r = 0;
g = 255;
b = 0;
}
}
if (cnt2 == 3) {
b = b + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
r = 0;
g = 255;
b = 255;
cnt2 = 4;
cnt = 0;
}
}
if (cnt2 == 4) {
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 5;
cnt = 0;
r = 0;
g = 0;
b = 255;
}
}
if (cnt2 == 5) {
r = r + 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 6;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 6) {
g = g - 31.875;
b = b - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 7;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 7) {
b = b - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 8;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 8) {
b = b - 31.875;
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 9;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 9) {
r = r - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 10;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 10) {
r = r - 31.875;
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 11;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
if (cnt2 == 11) {
g = g - 31.875;
stop(wait);
cnt = cnt + 1;
if (cnt == 9) {
cnt2 = 1;
cnt = 0;
r = 255;
g = 255;
b = 255;
}
}
for (int pxn = pixle_number_start; pxn <= pixle_number_end; pxn++) {
if (selector == false) {
primeBrightness();
brightness_v3 = brightness;
strip.setPixelColor(pxn, r * brightness_v3, g * brightness_v3, b * brightness_v3);
strip.show();
}
}
}
}
int R = 255;
int G = 255;
int B = 255;
int difference = 255 * brightness; // difference between each pixel color before and after. The smaller, the more difference. 255 is default.
int previousColor_r = 255;
int previousColor_g = 255;
int previousColor_b = 255;
void random_ColorGenerator() {
for (int ls = 0; ls < NUM_LEDS; ls++) {
if (timer > 0.01 || timerEnabled == false) {
primeBrightness();
R = random(255 * brightness);
G = random(255 * brightness);
B = random(255 * brightness);
if (previousColor_r + R > difference) {
R = random(255 * brightness);
if (previousColor_r + R > difference) {
R = random(128 * brightness * 2);
if (previousColor_r + R > difference) {
R = random(64 * brightness * 4);
if (previousColor_r + R > difference) {
R = random(32 * brightness * 8);
if (previousColor_r + R > difference) {
R = random(16 * brightness * 16);
}
}
}
}
}
if (previousColor_g + G > difference) {
G = random(255 * brightness);
if (previousColor_g + G > difference) {
G = random(128 * brightness * 2);
if (previousColor_g + G > difference) {
G = random(64 * brightness * 4);
if (previousColor_g + G > difference) {
G = random(32 * brightness * 8);
if (previousColor_g + G > difference) {
G = random(16 * brightness * 16);
}
}
}
}
}
if (previousColor_b + B > difference) {
B = random(255 * brightness);
if (previousColor_b + B > difference) {
B = random(128 * brightness * 2);
if (previousColor_b + B > difference) {
B = random(64 * brightness * 4);
if (previousColor_b + B > difference) {
B = random(32 * brightness * 8);
if (previousColor_b + B > difference) {
B = random(16 * brightness * 16);
}
}
}
}
}
strip.setPixelColor(ls, R, G, B);
strip.show();
button_sequence();
previousColor_r = R;
previousColor_g = G;
previousColor_b = B;
}
}
}
int potPin = 0; // Potentiometer output connected to analog pin 3
void colorWipe(int red, int green, int blue, int wait, bool use_custom_brightness_var) {
stop(0);
primeBrightness();
// Serial.println(brightness);
if (selector == false) {
if (use_custom_brightness_var == true) {
for (int pixle_number = 0; pixle_number < strip.numPixels(); pixle_number++) {
stop(0);
if (selector == false) {
primeBrightness();
strip.setPixelColor(pixle_number, red * brightness, green * brightness, blue * brightness);
strip.show();
stop(wait);
button_sequence();
}
}
} else if (use_custom_brightness_var == false) {
for (int pixle_number = 0; pixle_number < strip.numPixels(); pixle_number++) {
stop(0);
if (selector == false) {
strip.setPixelColor(pixle_number, red, green, blue);
strip.show();
stop(wait);
button_sequence();
}
}
}
}
}
void stop(float Delay) {
int time_del = 0;
if (time_del >= Delay) {
if (digitalRead(button_back) == HIGH) {
while (digitalRead(button_back) == HIGH) {
reset();
}
action = 0;
if (selector == false) {
repeater = false;
cur_pos = 13;
delay(200);
colorWipe(0, 0, 0, 0, true);
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
selector = true;
}
}
} else {
while (Delay > 0) {
if (digitalRead(button_back) == HIGH) {
Delay = 0;
action = 0;
stop(0);
} else {
delay(1);
Delay = Delay - 1;
}
}
}
}
float reset_timer = 0;
void reset() {
if (digitalRead(button_back) == HIGH) { // If serial print is disabled, enable the delay. If delay is disabled, enable serial print.
// Serial.println(reset_timer);
delay(20);
if (reset_timer > 200) {
digitalWrite(rst_pin, LOW);
} else {
reset_timer = reset_timer + 1;
}
} else {
reset_timer = 0;
}
}
void primeBrightness() {
brightness = analogRead(potPin);
brightness = brightness / 1000;
if (brightness > 1) {
brightness = 1;
}
}
void exit() {
action = 0;
repeater = false;
cur_pos = 13;
delay(200);
for (int i = 0; i < 37; i++) {
strip.setPixelColor(i, 0, 0, 0);
}
strip.setPixelColor(cur_pos, 255, 0, 255);
strip.show();
selector = true;
}
void randomcolorWipe(int red, int green, int blue, int wait, bool use_custom_brightness_var) {
stop(0);
primeBrightness();
if (selector == false) {
if (use_custom_brightness_var == true) {
for (int pixle_number = 0; pixle_number < strip.numPixels(); pixle_number++) {
stop(0);
if (selector == false) {
primeBrightness();
strip.setPixelColor(pixle_number, random(red * brightness), random(green * brightness), random(blue * brightness));
strip.show();
stop(wait);
button_sequence();
}
}
} else if (use_custom_brightness_var == false) {
for (int pixle_number = 0; pixle_number < strip.numPixels(); pixle_number++) {
stop(0);
if (selector == false) {
strip.setPixelColor(pixle_number, random(red), random(green), random(blue));
strip.show();
stop(wait);
button_sequence();
}
}
}
}
}
I'm open to including any new ideas.
not impressive
This portion of the code for the speaker is only a sample of frequencies. It was supposed to be a "for each item in list" experiment type of thing.
I've only started using it, so don't expect too much. If you have any suggestions for how I can improve, I'd love to hear.
strobe
What is "the real thing"?
This?
Yes! I,ve been trying to build it since I was like.... 8 years old or so. I want it because in minecraft, your only limited by your render distance and the 32768 bit integers. both of which don't apply to reality. Aka, it would theoretically be the most powerful tools in the universe. (By the way, if anyone has a two inch diameter neutron star, I need one for the power source.)
So all it does is turn lights on and off at special frequencies and rates?
At this point, yes. I'm mainly using it as a proof of concept for how the lights on the actual Command Block will work.
Here's a short description;
Light Description:
The color of the lights of the Command Block indicates its state or nature. Like people, it needs a method of communicating with us. The lights can also signify various things. For example, the function lights have five colors. Red implies a command failed to execute and has terminated the command. Orange informs a command executed unchecked, meaning the Command Block fails to check for errors, misspellings, code formatting, and other risks included with commands. Yellow signifies an unexecuted command or set of commands queued to execute when the Command Block encounters and resolves the issues. Green denotes a successful command execution with no errors or problems detected. If a light is blue, a command is added to a list and executed at specified times. Purple is a repeating command or operation. Usually, it is separate from other commands.
The center light expresses the state/feeling of the Command Block. It displays different colors to express its character. Red either expresses anger or issues a problem to the user. Orange implies that it is in sentry mode, usually when it feels threatened or scared. Yellow shows it is being cautious, usually when working on delicate tasks or in dangerous conditions/environments. Blue signifies sadness or a sense of delicacy, mainly in emotional conversations or if something triggers it to remember something that emotionally harmed itself or another entity. A light blue color is displayed when sensing dread or dismay. Purple signifies a natural feeling or sense of safety. Pink conveys that the Command Block is joyful or in love with something it appreciates, such as rescuing something it interprets as meaningful.
When first using the Command Block, all the function lights represent the status of each operation (not commands). When you begin utilizing commands, all the status lights make room for the command lights. They group into two lights that depict the status. White lights will be where the operations are displayed. Communication lights are an elaborate configuration of distinct colors. The manner of communicating via the lights is too complex to document on this page, though there is another page below where it sufficiently exemplifies how they operate.
Here are the warnings;
Warnings:
If EVERY function light is RED, ORANGE, OR BLUE, check the Command Block activity or try starting. This usually indicates a problem when running a command or set of commands.
The only time any lights are off is when all other lights are off or if that light is a communication light. IF ANY LIGHT IS OFF AND IS NOT A COMMUNICATOR LIGHT, check that light if it’s burnt out. Otherwise, it could mean there’s a severe problem.
If you experience the Command Block going sentient, acting upon its own decisions, and actively trying to kill you, if you are not dead, contact us right away because that’s not supposed to happen. If you are dead, try to prevent it from escaping.
The Command Block is pre-programmed. DO NOT ATTEMPT TO CHANGE THIS. If you want to customize the Command Block (for your safety and the safety of others), please get in touch with us. If you are trying to customize it on your own, it could result in a corrupt AI.
By the way, I finally got Bluetooth for it. Now you can listen to your favorite station with beautiful crunchy audio.
void runAction_Interstellar_sparkle_Black_Hole_Breath() {
for (int iz = 0; iz < 10; iz++) {
colorWipe(iz, 0, iz * 4, 0, false);
}
for (int iz = 10; iz > 0; iz--) {
randomcolorWipe(iz, 0, iz*4, 0, false);
}
}
32768 bit integers isn't a small limit... 10^9864 would be more than enough resolution to render more than a universe of universes with quark-sized minecraft blocks.
I meant, it could only interact with 32768 objects at a time. So if you told it to do something bigger than that range, it would not accept the command. Also, if you accidentally stab yourself with a tiny metal thingy covered with lead, is that a bad thing?