How would I loop this (please)

Hi,
I'm making a BIG HID joystick, writing a firmware was quiet a learning cliff but it works 100%, my next step is the software and I need a little help looping. Once I have the inputs looping in an automatic fashion I can write up a mux scheme which I am fairly comfortable with,
I've edited my sketch down a bit

#include "UnoJoy.h"

void setup(){
  setupUnoJoy();
}

void loop(){
  // Always be getting fresh data
  dataForController_t controllerData = getControllerData();
  setControllerData(controllerData);
}

dataForController_t getControllerData(void){
  
  // Set up a place for our controller data
  //  Use the getBlankDataForController() function, since
  //  just declaring a fresh dataForController_t tends
  //  to get you one filled with junk from other, random
  //  values that were in those memory locations before
  dataForController_t controllerData = getBlankDataForController();

// I'M WANTING TO LOOP FROM HERE DOWN, I'M NOT SURE WHERE TO END, EVEN THIS START POINT IS A GUESS. Sorry for shouting

     controllerData.bI0 = 1;
    controllerData.bI1 = 1;
    controllerData.bI2 = 1;
    controllerData.bI3 = 1;
    controllerData.bI4 = 1;
   
    //Set the sticks to full
    controllerData.al0 = 255;
    controllerData.al1 = 255;
    controllerData.al2 = 255;
    controllerData.al3 = 255;
    
    delay(1000);
    
    controllerData.bI0 = 0;
    controllerData.bI1 = 0;
    controllerData.bI2 = 0;
    controllerData.bI3 = 0;
    controllerData.bI4 = 0;
   
    //Set the sticks to zero
    controllerData.al0 = 0;
    controllerData.al1 = 0;
    controllerData.al2 = 0;
    controllerData.al3 = 0;
   

  // And return the data!
  return controllerData; 
}
    controllerData.bI0 = 1;

controllerData.bI1 = 1;
    controllerData.bI2 = 1;
    controllerData.bI3 = 1;
    controllerData.bI4 = 1;
 
    //Set the sticks to full
    controllerData.al0 = 255;
    controllerData.al1 = 255;
    controllerData.al2 = 255;
    controllerData.al3 = 255;
   
    delay(1000);
   
    controllerData.bI0 = 0;
    controllerData.bI1 = 0;
    controllerData.bI2 = 0;
    controllerData.bI3 = 0;
    controllerData.bI4 = 0;
 
    //Set the sticks to zero
    controllerData.al0 = 0;
    controllerData.al1 = 0;
    controllerData.al2 = 0;
    controllerData.al3 = 0;

I can't understand why you are doing this, much less why you would want to loop it. Why are you setting it to one thing, delaying, and then setting it to another before returning? Unless there's something funky going on in UnoJoy.h, you're not accomplishing anything.

In big picture terms, what does your code do, and what are you trying to make it do.

I'm making a HID joystick I set every input to 1 or 255 to test/prove the HID Firmware, this is just a basic proof, once I have my inputs cycling 0-1 0-255 I can put a multiplexing scheme for my 128 buttons and 48 pots in it's place with analogue reads etc .

I'm supposing from you reply I have guessed the wrong place to want a loop
Can you help?

Am I already in a loop at the point I've marked? I'm starting to think I am.

locodog:
I'm making a HID joystick I set every input to 1 or 255 to test/prove the HID Firmware, this is just a basic proof, once I have my inputs cycling 0-1 0-255 I can put a multiplexing scheme for my 128 buttons and 48 pots in it's place with analogue reads etc .

I'm supposing from you reply I have guessed the wrong place to want a loop
Can you help?

I took everything from your "I WANT TO LOOP HERE" statement down, so I don't know how it can be the wrong place. If I'm understanding what you want to do properly, change your getControllerData function to getControllerSetData() funciton. In that function, set everything to 255 and 1. Then, in loop():

void loop()
{
  dataForController_t controllerData = getBlankDataForController();
  setControllerData(controllerData);
  delay( 1000 );
  controller_data = getControllerSetData();
  setControllerData(controllerData);
  delay( 1000 );
}

This will set the controller with all 0s, wait one second, set the controller with all 255/1s, wait one second, then do it all again.

Is this what you wanted to do?

Exactly, thanks a bunch. +karma