int8_t direction;
/** Custom test. The function will be called many times during the test, 
till You issue "x" menu command.
*/
void RobotLine::loop() {
	print("Start\n\r");
	direction = 0;
	end();
}
/** Generic actions, use them as templates
*/
...
void RobotLine::loop0() { // Left
	direction--; 
	loop2();
}
void RobotLine::loop1() { // Right
	direction++; 
	loop2();
}
void RobotLine::loop2() {
	print("Dir: %i", direction);
	const uint8_t MAX_DIRECTION = 5;
	const uint8_t FORWARD_SPEED = 30;
	if (direction < -MAX_DIRECTION)
		direction = -MAX_DIRECTION;
	if (direction > MAX_DIRECTION)
		direction = MAX_DIRECTION;
	uint8_t step = (127 - FORWARD_SPEED) / MAX_DIRECTION;
	go(FORWARD_SPEED + direction * step, FORWARD_SPEED - direction * step);
	end();
}
void RobotLine::loop3() { // Forward
	go(40, 40); 
	direction = 0; 
	end();
}
void RobotLine::loop4() { // Stop
	stop(); 
	direction = 0; 
	end() ;
}
void RobotLine::loop5() { // Backward
	go(-40, 40);
	direction = 0; 
	end() ;
}
    
   Na početku je deklaracija varijable:
int8_t direction;
Radi se o "globalnoj varijabli", koja je vidljiva u cijelom programu i prenosi podatke između funkcija.
Funkcija "loop()" pokreće  program.
"loop0()" skreće lijevo, "loop1()" desno.
Obje pozivaju funkciju "loop2()", koja ograničava brzinu i upravlja motorima.
"loop3()" je za ravno naprijed, "loop5()" za natrag.
"loop4()" zaustavlja robota.