I have an ugly way. Add this line just before the closing brace.
while(1); // remain here forever
This is the complete code.
#include <Adafruit_NeoPixel.h>
#define PIN_NEO_PIXEL 4 // Arduino pin that connects to NeoPixel
#define NUM_PIXELS 78 // The number of LEDs (pixels) on NeoPixel
#define DELAY_INTERVAL 50
Adafruit_NeoPixel NeoPixel(NUM_PIXELS, PIN_NEO_PIXEL, NEO_GRB + NEO_KHZ800);
void setup() {
NeoPixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
NeoPixel.clear(); // set all pixel colors to 'off'. It only takes effect if pixels.show() is called
NeoPixel.show();
}
void loop() {
// turn pixels to white one by one with delay between each pixel
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) { // for each pixel
NeoPixel.setPixelColor(pixel, NeoPixel.Color(255, 255, 255)); // it only takes effect if pixels.show() is called
NeoPixel.show(); // send the updated pixel colors to the NeoPixel hardware.
delay(DELAY_INTERVAL); // pause between each pixel
}
while (1); // remain here forever
}
it being Sunday, I don't know when you might be able to reply, but I will post and wait.
I hooked up the board in the garage and it kept giving me an error message, saying that //./COM4 couldn't be found, but it also said (at the bottom of the screen) that Arduino Uno was on COM4 (connected).
so I brought that computer inside and hooked it up again (using the same cable) and it worked (sort of).
it would indeed go to the end of the pixels (relative) then stop. but then it would disconnect from the computer for a second, then reconnect and restart the whole program. when I took out the 'while(1);', then it would go only 40 pixels and restart (when I had in the program it was 100 pixels)
weird weird weird.............
after my last post, I did get it to work as I wanted.
that was my original guess of how many pixels I would need - it is actually 72.
oddly enough, at one time it did work with only the power from the computer! I am currently recharging my batteries to see if that makes any difference.
so, I just figured out that what I was doing to simulate what would be off and on for the circuit wasn't (apparently) how I should do it. I was disconnecting the LED strip from the Arduino. what I need to do is disconnect the power from the Arduino. after all, that is what my switch will be doing.
doing it that way has now given me many repeated times that it works correctly!