Unsing a button to jump to the next pice of code

I am a total newbie to Arduino so apologies in advance!

I am trying to setup an Adafruit BicolorMatrix with a pushbutton, the idea is that eventually I will get it linked into my app that I have had developed (I did the design but I got an outside programmer!)

I am trying to replicate Theatre Cue lights, normally wired but I have come up with a wifi system. http://stagecue.eu/?page_id=27

Anyway, for now I am simply trying to get the lights to work via a pushbutton and my limited knowledge doesn't even allow me that functionality after several hours trawling the web!

I would be happy to try this code out with ident icon up first, then scrolling text, then flashing Red whole matrix...
So far so good, but I cant figure out how to then press a button to stop the flashing. (the button would also send a wifi signal back to the iPad at this point).

Once acknowledged, the iPad could send another signal to start a Green matrix display flashing, and again pressing the same button would steady the Red light and send another message back.

I am not asking how to send a message via wifi, great if you know how but just to advance through the stages would be a start.

Code I have managed so far as below. the "for(int i = 0; i < 1; i);" is the only way I have found to have an infinite flash loop.
(didn't save my earlier efforts, now that flash wont work constantly either, HELP!

/***************************************************
This is a library for our I2C LED Backpacks

Designed specifically to work with the Adafruit LED Matrix backpacks
----> Adafruit Mini 0.8 8x8 LED Matrix w/I2C Backpack - Yellow-Green : ID 872 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Yellow : ID 871 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Red : ID 870 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

These displays use I2C to communicate, 2 pins are required to
interface. There are multiple selectable I2C addresses. For backpacks
with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
with 3 Address Select pins: 0x70 thru 0x77

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
const int buttonInput = 2; // the number of the pushbutton pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int i = 0;

Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();

void setup() {
pinMode(buttonInput, INPUT);
digitalWrite(buttonInput, HIGH);

matrix.begin(0x70); // pass in the address
}

void loop() {

matrix.clear();
matrix.drawRect(0,0, 8,8, LED_GREEN);
matrix.fillRect(2,2, 4,4, LED_YELLOW);
matrix.writeDisplay(); // write the changes we just made to the display
delay(2000);

matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
matrix.setRotation(3);
matrix.setTextSize(0);
matrix.setTextColor(LED_GREEN);
for (int8_t x=7; x>=-36; x--) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print("Cue1");
matrix.writeDisplay();
delay(100);
}

for(int i = 0; i < 1; i); // SHOULD flash the light infinitely till button pressed, DID WORK BUT HAVE MESSED UP SOMEWHERE!!
matrix.fillRect(0,0, 8,8, LED_RED);
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
matrix.clear();
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
{
/****************************************************
THIS BIT I CANT GET TO WORK...
// flashes the light infinitely
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH)

THEN SWITCH TO STATIC STATE

for(int i = 0; i < 1; i);
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_RED);
matrix.writeDisplay(); // write the changes we just made to the display

****************************************************/
{
for(int i = 0; i < 1; i); // flashes the light infinitely till button pressed
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
matrix.clear();
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);

for(int i = 0; i < 1; i); // light stays on solid for approx 30 seconds then the cycle reverts to RED waiting to receive message so that it can flash again.
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(30000);

}
}}

Use code tags, please modify your post.

 for(int i = 0; i < 1; i);

As far as I can see will halt your program. In other words it will never go beyond this line. Is that what you want?

What do you want that line to do?

if checking my code, please use this instead, managed to get the matrix flashing and commented out what I need to achieve in the long run but Button functionality would be good at this stage:

Thanks in advance!

/***************************************************
This is a library for our I2C LED Backpacks

Designed specifically to work with the Adafruit LED Matrix backpacks
----> Adafruit Mini 0.8 8x8 LED Matrix w/I2C Backpack - Yellow-Green : ID 872 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Yellow : ID 871 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Red : ID 870 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

These displays use I2C to communicate, 2 pins are required to
interface. There are multiple selectable I2C addresses. For backpacks
with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
with 3 Address Select pins: 0x70 thru 0x77

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
const int buttonPin = 2; // the number of the pushbutton pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();

void setup() {
pinMode(buttonPin, INPUT);
matrix.begin(0x70); // pass in the address
}

void loop() {
/*************************************************************
STARTUP LOGO IDENT
*************************************************************/
matrix.clear();
matrix.drawRect(0,0, 8,8, LED_GREEN);
matrix.fillRect(2,2, 4,4, LED_YELLOW);
matrix.writeDisplay(); // write the changes we just made to the display
delay(2000);

/*************************************************************
THIS SCROLLING CUE NUMBER DISPLAY TO BE RECEIVED FROM THE IPAD viA WIFI
*************************************************************/
matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
matrix.setRotation(3);
matrix.setTextSize(0);
matrix.setTextColor(LED_YELLOW);
for (int8_t x=7; x>=-36; x--) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print("Cue1");
matrix.writeDisplay();
delay(100);
}

/*************************************************************
THIS RED FLASHING STANDBY COMMAND TO BE RECEIVED FROM IPAD
*************************************************************/

for(int i = 0; i < 20; i++)
{
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_RED);
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
matrix.clear();
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
}

/**********************************************************************************
BUTTON PRESS (DOES NOT WORK!) STEADIES THE LIGHT AND SENDS A MESSAGE TO IPAD
***********************************************************************************/

// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {

{
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_RED);
matrix.writeDisplay(); // write the changes we just made to the display
delay(3000);

}

/**********************************************************************************
THIS GREEN FLASHING STANDBY COMMAND TO BE RECEIVED FROM IPAD
*/
for(int i = 0; i < 20; i++)
{
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
matrix.clear();
matrix.writeDisplay(); // write the changes we just made to the display
delay(200);
}
/

BUTTON PRESS (DOES NOT WORK!) STEADIES THE LIGHT AND SENDS A MESSAGE TO IPAD
***********************************************************************************/

// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {

{
matrix.clear();
matrix.fillRect(0,0, 8,8, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(3000);

}
}}}

}
  }}}

Rubbish. Each } goes on its own line!

Use code tags!

Please edit your post and add code tags around your code. It's nearly impossible to read otherwise.

I'm the second one in this thread to ask you to do this. I'm not going to try to figure out your code without code tags. It's just too hard, and a waste of time.

Please edit your post and add code tags around your code.

+1 from me as well.

It is a sort of test.
If you can't read the how to use the forum stick post and post the code correctly you are never going to understand the help we can offer.
If you don't want to comply then you don't deserve the help we can offer.