struct e funzioni

Ho bisogno di creare una struct e ho trovato qualcosa ma non sono certo di aver capito come funziona.

http://www.arduino.cc/playground/Code/Struct#Description

Tutto parte dal bisogno di avere una funzione che mi restituisca 2 valori, un booleano e un intero. Allora ho pensato di fare una struttura, ma devo mettere una libreria o qualcosa del genere?

mi sapete dare qualche consiglio? scusate magari è una cavolata ma sono una capra in programmazione...

EDIT sono riuscito a creare la struttura ma ora non saprei modificare i dati all'interno... devo fare 2 funzioni vero? una che mi restituisce un booleano e una che mi restituisce un intero, vero?

EDIT2 forse dovrei usare windows?

Intanto per usare i booleani con l'avr gcc devi includere la seguente libreria:

stdbool.h

/* stdbool.h for GNU.  */
#ifndef __STDBOOL_H__
#define __STDBOOL_H__      1

/* The type `bool' must promote to `int' or `unsigned int'.  The constants
   `true' and `false' must have the value 0 and 1 respectively.  */
typedef enum
  {
    false = 0,
    true = 1
  } bool;

/* The names `true' and `false' must also be made available as macros.  */
#define false      false
#define true      true

/* Signal that all the definitions are present.  */
#define __bool_true_false_are_defined      1

#endif      /* stdbool.h */

Non ho mai provato ma dice che devi aggiungere un .h
How can I use structs as function returntypes or as parameters to functions?
The usual arduino workaround/hack is to have all functions that requires custom datatstructures to be placed in an additional .h file. Just create a new tab in the IDE and give it a name.h then #include "name.h"

ah capito... sarebbe come creare una specie di libreria no? domani nel tardo pomeriggio riprovo a fare il programma... io volevo fare una struttura per i motori, anche se per due è esagerato però mi piaceva l'idea di definire la struttura motore composta da un id, velocità e direzione.

Ripeto non sono un buon programmatore ma ho idea che questa cosa mi snellisca il programma. Sbaglio?

comunque grazie per le risposte :smiley: