Timer

skizoh:

#include <Wire.h>

#include <NXShield.h>
#include <NXTTouch.h>
#include <NXTLight.h>
#include <SumoEyes.h>
#include <ACCLNx.h>
#include <NXTUS.h>

//
// declare the NXShield(s) attached to your Arduino.
//
NXShield  nxshield;

//
// declare analog devices attached to nxshields.
//
NXTTouch  touch1;

Void main()
{
str= 100
avancer(str);// comme ça l'appel de fonction avec paramètre

}

Void Avancer(int str)
{
int str;

// Drive both motors forward and backward for a specific number of
    // rotations
    delay(1000);
    sprintf(str, "Both Motors Forward %d Rotations", rotations);
    Serial.println(str);
    str[0] = '\0';//bon reflex =)
    nxshield.bank_a.motorRunRotations(SH_Motor_Both,
                     SH_Direction_Forward,
                     SH_Speed_Medium,
                     rotations,
                     SH_Completion_Wait_For,
                     SH_Next_Action_BrakeHold);
    delay(1000);
    sprintf(str, "Both Motors Reverse %d Rotations", rotations);
    Serial.println(str);
    str[0] = '\0';
    nxshield.bank_a.motorRunRotations(SH_Motor_Both,
                     SH_Direction_Reverse,
                     SH_Speed_Medium,
                     rotations,
                     SH_Completion_Wait_For,
                     SH_Next_Action_BrakeHold);

Serial.println("Bank B motors >>");
   
}

Petite question,

je dois gerer l'évitement durant mon déplacement (en gros je m’arrête si y a quelqu'un devant), est il plus simple de mettre une condition si dans mon void.avancer() ou de créer un programme annexe