Loop code without manually pressing the button

In a piece off code I am modifying I have a button connected to start the code and then it resets its self afterwards. Is they a way to make the arduino loop that code without manually pressing the button again.

This is a section off the code:
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#define PIN 6
#define BUTTON_PIN 9

Adafruit_NeoPixel strip = Adafruit_NeoPixel(120, PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

void(* resetFunc) (void) = 0; //declare reset function @ address 0

void setup() {
strip.show(); // Initialize all pixels to ‘off’
void loop() {
// Get current button state.
bool newState = digitalRead(BUTTON_PIN);

// Check if state changed from high to low (button press).
if (newState == LOW && oldState == HIGH) {
// Short delay to debounce button.
// Check if button is still low after debounce.
newState = digitalRead(BUTTON_PIN);
if (newState == LOW) {
if (showType > 9)

// Set the last button state to the old state.
oldState = newState;

void startShow(int i) {
colorWipe(strip.Color(75, 0, 0), 50); // Red
colorWipe(strip.Color(0, 75, 0), 50); // Green
colorWipe(strip.Color(0, 0, 75), 50); // Blue
theaterChase(strip.Color(75, 75, 75), 50); // White
theaterChase(strip.Color(75, 0, 0), 50); // Red
theaterChase(strip.Color(0, 0, 75), 50); // Blue
resetFunc(); //call reset


Thanks Reece

I don’t think so unfortunately that’s the only way to manually loop it…

Now programmatically - there might be ways :slight_smile:

(Why do you reset really ?)

I reset it because once the code ends it keeps displaying the led's so resetting it enables them to be turned off. :slight_smile:

Or you could just turn them off. That would work too wouldn't it? Anytime you catch yourself wanting to reset your board from code it's a good sign you need to refactor it.