user55020: I'm simply trying to light up some pins on a customized circuit board via Arduino. 
 My code below has the seemingly common error "a function-definition is not allowed here before '{' token".  I've scoured my code for open/close curly brackets and semi-colons. I also regularly do a quick ctrl+T to format it.  Now I am at a loss - any info/advice greatly appreciated!  The error occurs at the '{' after the 'void loop()' line towards the bottom:
// serially read in 32 bytes at a time to send to shift registers.
// currently updating every 0.1s in Matlab

// Define which pins will be used for the Shift Register control
int dataPin = 2;
int latchPin = 3;
int clockPin = 4;

#include <SPI.h>

void setup()
{
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);

  SPI.setClockDivider(SPI_CLOCK_DIV16);
  SPI.begin();

  //Configure each IO Pin
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);

  Serial.begin(115200);
  delay(1000);

  int seq
  [32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

  int timeElapsed = 2000;
  int timeOld = 0;
  int interval = 100;

  void loop()
  {
    Serial.flush();
    Serial.println('K');
    for (int i = 0; i < 32; i++)
    {
      while (Serial.available() == 0);
      {
        seq[i] = Serial.read();
      }
    }
    digitalWrite(latchPin , HIGH);
    digitalWrite(latchPin , LOW);
    for (int i = 0; i < 32; i++)
    {
      SPI.transfer(seq[i]);
    }
    digitalWrite(latchPin , HIGH); //necessary to tramsit to board
  }


user55024: There's no closing bracket for your setup() function and your loop() function is inside setup(). Close off setup() with a }and then start loop()!

55020: <p>I'm simply trying to light up some pins on a customized circuit board via Arduino. 
 My code below has the seemingly common error "a function-definition is not allowed here before '{' token".  I've scoured my code for open/close curly brackets and semi-colons. I also regularly do a quick ctrl+T to format it.  Now I am at a loss - any info/advice greatly appreciated!  The error occurs at the '{' after the 'void loop()' line towards the bottom:</p>

<pre><code>// serially read in 32 bytes at a time to send to shift registers.
// currently updating every 0.1s in Matlab

// Define which pins will be used for the Shift Register control
int dataPin = 2;
int latchPin = 3;
int clockPin = 4;

#include &lt;SPI.h&gt;

void setup()
{
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);

  SPI.setClockDivider(SPI_CLOCK_DIV16);
  SPI.begin();

  //Configure each IO Pin
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);

  Serial.begin(115200);
  delay(1000);

  int seq
  [32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

  int timeElapsed = 2000;
  int timeOld = 0;
  int interval = 100;

  void loop()
  {
    Serial.flush();
    Serial.println('K');
    for (int i = 0; i &lt; 32; i++)
    {
      while (Serial.available() == 0);
      {
        seq[i] = Serial.read();
      }
    }
    digitalWrite(latchPin , HIGH);
    digitalWrite(latchPin , LOW);
    for (int i = 0; i &lt; 32; i++)
    {
      SPI.transfer(seq[i]);
    }
    digitalWrite(latchPin , HIGH); //necessary to tramsit to board
  }
</code></pre>
 55024: <p>There's no closing bracket for your <code>setup()</code> function and your <code>loop()</code> function is inside <code>setup()</code>. Close off <code>setup()</code> with a <code>}</code>and then start <code>loop()</code>!</p>
