library/Doku/Doxygen/latex/d2/d40/group__higherlevelmeths.tex
2018-11-13 11:15:10 +01:00

495 lines
25 KiB
TeX

\hypertarget{group__higherlevelmeths}{}\section{Methods}
\label{group__higherlevelmeths}\index{Methods@{Methods}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
void \hyperlink{group__higherlevelmeths_ga71df7ac5e41ae776a6c786d3dc36f35a}{Code\+Racer\+::stop\+\_\+driving} ()
\begin{DoxyCompactList}\small\item\em Stops the racer and sets status L\+E\+Ds. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga8be6a850099812153dcf5768d7fc8b8c}{Code\+Racer\+::drive\+\_\+forward} ()
\begin{DoxyCompactList}\small\item\em Sets the speed and the directions of both drives so that it will move forward. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_gaae6fc379ec43cbe2cb2f63fbd12dbe0d}{Code\+Racer\+::drive\+\_\+forward} (uint8\+\_\+t left\+\_\+speed, uint8\+\_\+t right\+\_\+speed)
\begin{DoxyCompactList}\small\item\em Sets the speed as specified for both drives and the directions of both drives so that it will move forward. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga98aa8a5a46f769d59e6c1067c8418cfb}{Code\+Racer\+::drive\+\_\+backward} ()
\begin{DoxyCompactList}\small\item\em Sets the speed and the directions of both drives so that it will move backward. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga6cd8356ac76360b014db6170276b6b30}{Code\+Racer\+::drive\+\_\+backward} (uint8\+\_\+t left\+\_\+speed, uint8\+\_\+t right\+\_\+speed)
\begin{DoxyCompactList}\small\item\em Sets the speed as specified for both drives and the directions of both drives so that it will move backward. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga86b7caf6ff46e9d1ad90ed507864b175}{Code\+Racer\+::turn\+\_\+left} ()
\begin{DoxyCompactList}\small\item\em Will turn the racer to the left for the internally stroe time in ms and with the internally stored speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga30e1ec3fbbc206f93ea66dbf91b5fd95}{Code\+Racer\+::turn\+\_\+left} (unsigned long turn\+\_\+for\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Will turn the racer to the left for the specified time in ms and with the internally stored speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_gae6daa587199e5bf95b1aac675de53b0e}{Code\+Racer\+::turn\+\_\+left} (unsigned long turn\+\_\+for\+\_\+ms, uint8\+\_\+t left\+\_\+speed, uint8\+\_\+t right\+\_\+speed)
\begin{DoxyCompactList}\small\item\em Will turn the racer to the left for the specified time in ms and with the specified speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga8969fb2d6e2b5ac44a99197931e6b8da}{Code\+Racer\+::turn\+\_\+right} ()
\begin{DoxyCompactList}\small\item\em Will turn the racer to the right for the internally stroe time in ms and with the internally stored speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_gae1f175aad98d773b0206f483ae0bb4ea}{Code\+Racer\+::turn\+\_\+right} (unsigned long turn\+\_\+for\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Will turn the racer to the right for the specified time in ms and with the internally stored speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_gad10b3457489cc7e25ffb4d64c539528a}{Code\+Racer\+::turn\+\_\+right} (unsigned long turn\+\_\+for\+\_\+ms, uint8\+\_\+t left\+\_\+speed, uint8\+\_\+t right\+\_\+speed)
\begin{DoxyCompactList}\small\item\em Will turn the racer to the right for the specified time in ms and with the specified speed. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga128683caea019a89bce06f722ba92556}{Code\+Racer\+::start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance} ()
\begin{DoxyCompactList}\small\item\em Enables to stopp the racer if during a distance measurement the measured distance is smaller then the internally stored minimal distance. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_ga64bc1b2a8ed5bc3ec5e706fa70a1385d}{Code\+Racer\+::start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance} (unsigned long min\+\_\+distance\+\_\+cm)
\begin{DoxyCompactList}\small\item\em Enables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance. \end{DoxyCompactList}\item
void \hyperlink{group__higherlevelmeths_gac664109241d08b8dc52db5721f394b22}{Code\+Racer\+::stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance} ()
\begin{DoxyCompactList}\small\item\em Disables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance. \end{DoxyCompactList}\item
bool \hyperlink{group__higherlevelmeths_ga34e2fe2123e76fd844482dfef6c5a9c8}{Code\+Racer\+::start\+\_\+stop} ()
\begin{DoxyCompactList}\small\item\em This will return if the codracer is in active mode or not. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection{Detailed Description}
\subsection{Function Documentation}
\mbox{\Hypertarget{group__higherlevelmeths_ga71df7ac5e41ae776a6c786d3dc36f35a}\label{group__higherlevelmeths_ga71df7ac5e41ae776a6c786d3dc36f35a}}
\index{Methods@{Methods}!stop\+\_\+driving@{stop\+\_\+driving}}
\index{stop\+\_\+driving@{stop\+\_\+driving}!Methods@{Methods}}
\subsubsection{\texorpdfstring{stop\+\_\+driving()}{stop\_driving()}}
{\footnotesize\ttfamily void Code\+Racer\+::stop\+\_\+driving (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Stops the racer and sets status L\+E\+Ds.
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 161 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
161 \{
162 \_servo\_sweep = \textcolor{keyword}{false};
163 \_drive = \textcolor{keyword}{false};
164 set\_drives\_stop\_left\_right();
165 set\_leds\_left\_stop\_frwd\_right(LEDOFF, LEDON, LEDOFF, LEDOFF);
166 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga8be6a850099812153dcf5768d7fc8b8c}\label{group__higherlevelmeths_ga8be6a850099812153dcf5768d7fc8b8c}}
\index{Methods@{Methods}!drive\+\_\+forward@{drive\+\_\+forward}}
\index{drive\+\_\+forward@{drive\+\_\+forward}!Methods@{Methods}}
\subsubsection{\texorpdfstring{drive\+\_\+forward()}{drive\_forward()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::drive\+\_\+forward (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Sets the speed and the directions of both drives so that it will move forward.
The speed is taken from the header file or set by one of the methods defined in the lower level drive methods section \begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 173 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
174 \{
175 drive\_forward(\_drive\_left\_speed, \_drive\_right\_speed);
176 \}
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=206pt]{d2/d40/group__higherlevelmeths_ga8be6a850099812153dcf5768d7fc8b8c_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{group__higherlevelmeths_gaae6fc379ec43cbe2cb2f63fbd12dbe0d}\label{group__higherlevelmeths_gaae6fc379ec43cbe2cb2f63fbd12dbe0d}}
\index{Methods@{Methods}!drive\+\_\+forward@{drive\+\_\+forward}}
\index{drive\+\_\+forward@{drive\+\_\+forward}!Methods@{Methods}}
\subsubsection{\texorpdfstring{drive\+\_\+forward()}{drive\_forward()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::drive\+\_\+forward (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{left\+\_\+speed, }\item[{uint8\+\_\+t}]{right\+\_\+speed }\end{DoxyParamCaption})}
Sets the speed as specified for both drives and the directions of both drives so that it will move forward.
The specified speed values for both drives will be stored internaly so next time if you use e.\+g. drive\+\_\+forward() exactly the here specified values will be taken.
\begin{DoxyParams}{Parameters}
{\em left\+\_\+speed} & speed for the left side drive. 0$<$=speed$<$=255 \\
\hline
{\em right\+\_\+speed} & speed for the right side drive. 0$<$=speed$<$=255 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 185 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
186 \{
187 set\_drives\_states\_left\_right(DRIVEFRWD, DRIVEFRWD);
188 set\_drives\_speed\_left\_right(left\_speed, right\_speed);
189 set\_leds\_left\_stop\_frwd\_right(LEDOFF, LEDOFF, LEDON, LEDOFF);
190 \_drive = \textcolor{keyword}{true};
191 \_drive\_set\_at\_ms = millis();
192 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga98aa8a5a46f769d59e6c1067c8418cfb}\label{group__higherlevelmeths_ga98aa8a5a46f769d59e6c1067c8418cfb}}
\index{Methods@{Methods}!drive\+\_\+backward@{drive\+\_\+backward}}
\index{drive\+\_\+backward@{drive\+\_\+backward}!Methods@{Methods}}
\subsubsection{\texorpdfstring{drive\+\_\+backward()}{drive\_backward()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::drive\+\_\+backward (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Sets the speed and the directions of both drives so that it will move backward.
The speed is taken from the header file or set by one of the methods defined in the lower level drive methods section \begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 199 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
200 \{
201 drive\_backward(\_drive\_left\_speed, \_drive\_right\_speed);
202 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga6cd8356ac76360b014db6170276b6b30}\label{group__higherlevelmeths_ga6cd8356ac76360b014db6170276b6b30}}
\index{Methods@{Methods}!drive\+\_\+backward@{drive\+\_\+backward}}
\index{drive\+\_\+backward@{drive\+\_\+backward}!Methods@{Methods}}
\subsubsection{\texorpdfstring{drive\+\_\+backward()}{drive\_backward()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::drive\+\_\+backward (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{left\+\_\+speed, }\item[{uint8\+\_\+t}]{right\+\_\+speed }\end{DoxyParamCaption})}
Sets the speed as specified for both drives and the directions of both drives so that it will move backward.
The specified speed values for both drives will be stored internaly so next time if you use e.\+g. drive\+\_\+backward() exactly the here specified values will be taken.
\begin{DoxyParams}{Parameters}
{\em left\+\_\+speed} & speed for the left side drive. 0$<$=speed$<$=255 \\
\hline
{\em right\+\_\+speed} & speed for the right side drive. 0$<$=speed$<$=255 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 211 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
212 \{
213 set\_drives\_states\_left\_right(DRIVEBACK, DRIVEBACK);
214 set\_drives\_speed\_left\_right(left\_speed, right\_speed);
215 set\_leds\_left\_stop\_frwd\_right(LEDOFF, LEDON, LEDON, LEDOFF);
216 \_drive = \textcolor{keyword}{true};
217 \_drive\_set\_at\_ms = millis();
218 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga86b7caf6ff46e9d1ad90ed507864b175}\label{group__higherlevelmeths_ga86b7caf6ff46e9d1ad90ed507864b175}}
\index{Methods@{Methods}!turn\+\_\+left@{turn\+\_\+left}}
\index{turn\+\_\+left@{turn\+\_\+left}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+left()}{turn\_left()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+left (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Will turn the racer to the left for the internally stroe time in ms and with the internally stored speed.
The speed for both the left side and right side drive can be set by the methods described in the lower level drive section. The turn to left time can be set by thoose methods as well. The method is delayed until the racer has turned. \begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 226 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
227 \{
228 turn\_left(\_turn\_left\_for\_ms, \_drive\_left\_speed, \_drive\_right\_speed);
229 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga30e1ec3fbbc206f93ea66dbf91b5fd95}\label{group__higherlevelmeths_ga30e1ec3fbbc206f93ea66dbf91b5fd95}}
\index{Methods@{Methods}!turn\+\_\+left@{turn\+\_\+left}}
\index{turn\+\_\+left@{turn\+\_\+left}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+left()}{turn\_left()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+left (\begin{DoxyParamCaption}\item[{unsigned long}]{turn\+\_\+for\+\_\+ms }\end{DoxyParamCaption})}
Will turn the racer to the left for the specified time in ms and with the internally stored speed.
The specified duration of time is stored internally and will be used next time by e.\+g. turn\+\_\+left()
\begin{DoxyParams}{Parameters}
{\em turn\+\_\+for\+\_\+ms} & duration of time in ms to turn the racer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 237 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
238 \{
239 turn\_left(turn\_for\_ms, \_drive\_left\_speed, \_drive\_right\_speed);
240 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_gae6daa587199e5bf95b1aac675de53b0e}\label{group__higherlevelmeths_gae6daa587199e5bf95b1aac675de53b0e}}
\index{Methods@{Methods}!turn\+\_\+left@{turn\+\_\+left}}
\index{turn\+\_\+left@{turn\+\_\+left}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+left()}{turn\_left()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+left (\begin{DoxyParamCaption}\item[{unsigned long}]{turn\+\_\+for\+\_\+ms, }\item[{uint8\+\_\+t}]{left\+\_\+speed, }\item[{uint8\+\_\+t}]{right\+\_\+speed }\end{DoxyParamCaption})}
Will turn the racer to the left for the specified time in ms and with the specified speed.
The specified duration of time and the specified speeds are stored internally and will be used next time by e.\+g. turn\+\_\+left()
\begin{DoxyParams}{Parameters}
{\em turn\+\_\+for\+\_\+ms} & duration of time in ms to turn the racer \\
\hline
{\em left\+\_\+speed} & speed for the left side drive \\
\hline
{\em right\+\_\+speed} & speed for the right side drive \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 250 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
251 \{
252 \_drive = \textcolor{keyword}{false};
253 set\_leds\_left\_stop\_frwd\_right(LEDON, LEDOFF, LEDOFF, LEDOFF); \textcolor{comment}{// LEDs setzen}
254 set\_drives\_states\_left\_right(DRIVEBACK, DRIVEFRWD);
255 set\_drives\_speed\_left\_right(left\_speed, right\_speed);
256 \textcolor{comment}{// wait set delay for the timed turn}
257 \_turn\_left\_for\_ms = turn\_for\_ms;
258 delay(\_turn\_left\_for\_ms);
259 \textcolor{comment}{// stop drives again}
260 set\_drives\_stop\_left\_right();
261 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga8969fb2d6e2b5ac44a99197931e6b8da}\label{group__higherlevelmeths_ga8969fb2d6e2b5ac44a99197931e6b8da}}
\index{Methods@{Methods}!turn\+\_\+right@{turn\+\_\+right}}
\index{turn\+\_\+right@{turn\+\_\+right}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+right()}{turn\_right()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+right (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Will turn the racer to the right for the internally stroe time in ms and with the internally stored speed.
The speed for both the left side and right side drive can be set by the methods described in the lower level drive section. The turn to right time can be set by thoose methods as well. The method is delayed until the racer has turned. \begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 269 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
270 \{
271 turn\_right(\_turn\_right\_for\_ms, \_drive\_left\_speed, \_drive\_right\_speed);
272 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_gae1f175aad98d773b0206f483ae0bb4ea}\label{group__higherlevelmeths_gae1f175aad98d773b0206f483ae0bb4ea}}
\index{Methods@{Methods}!turn\+\_\+right@{turn\+\_\+right}}
\index{turn\+\_\+right@{turn\+\_\+right}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+right()}{turn\_right()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+right (\begin{DoxyParamCaption}\item[{unsigned long}]{turn\+\_\+for\+\_\+ms }\end{DoxyParamCaption})}
Will turn the racer to the right for the specified time in ms and with the internally stored speed.
The specified duration of time is stored internally and will be used next time by e.\+g. turn\+\_\+right()
\begin{DoxyParams}{Parameters}
{\em turn\+\_\+for\+\_\+ms} & duration of time in ms to turn the racer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 280 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
281 \{
282 turn\_right(turn\_for\_ms, \_drive\_left\_speed, \_drive\_right\_speed);
283 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_gad10b3457489cc7e25ffb4d64c539528a}\label{group__higherlevelmeths_gad10b3457489cc7e25ffb4d64c539528a}}
\index{Methods@{Methods}!turn\+\_\+right@{turn\+\_\+right}}
\index{turn\+\_\+right@{turn\+\_\+right}!Methods@{Methods}}
\subsubsection{\texorpdfstring{turn\+\_\+right()}{turn\_right()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily void Code\+Racer\+::turn\+\_\+right (\begin{DoxyParamCaption}\item[{unsigned long}]{turn\+\_\+for\+\_\+ms, }\item[{uint8\+\_\+t}]{left\+\_\+speed, }\item[{uint8\+\_\+t}]{right\+\_\+speed }\end{DoxyParamCaption})}
Will turn the racer to the right for the specified time in ms and with the specified speed.
The specified duration of time and the specified speeds are stored internally and will be used next time by e.\+g. turn\+\_\+right()
\begin{DoxyParams}{Parameters}
{\em turn\+\_\+for\+\_\+ms} & duration of time in ms to turn the racer \\
\hline
{\em left\+\_\+speed} & speed for the left side drive \\
\hline
{\em right\+\_\+speed} & speed for the right side drive \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 293 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
294 \{
295 \_drive = \textcolor{keyword}{false};
296 set\_leds\_left\_stop\_frwd\_right(LEDOFF, LEDOFF, LEDOFF, LEDON); \textcolor{comment}{// LEDs setzen}
297 set\_drives\_states\_left\_right(DRIVEFRWD, DRIVEBACK);
298 set\_drives\_speed\_left\_right(left\_speed, right\_speed);
299 \textcolor{comment}{// wait set delay for the timed turn}
300 \_turn\_right\_for\_ms = turn\_for\_ms;
301 delay(\_turn\_right\_for\_ms);
302 \textcolor{comment}{// stop drives again}
303 set\_drives\_stop\_left\_right();
304 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga128683caea019a89bce06f722ba92556}\label{group__higherlevelmeths_ga128683caea019a89bce06f722ba92556}}
\index{Methods@{Methods}!start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}}
\index{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}!Methods@{Methods}}
\subsubsection{\texorpdfstring{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance()}{start\_stop\_at\_min\_distance()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the internally stored minimal distance.
This allow all of the none-\/single shot ultra sonic measurement methods to stopp the racer in the case the measured distance is smaller than minimal distance. This is just the enablement -\/ you have to call one of the none-\/single-\/shot ultra sonic measurement methods continously while driving and maybe sweeping the servo. If the racer was stopped can be checked with stopped\+\_\+at\+\_\+min\+\_\+distance() -\/ it will return true in that case. The minimal distance can be set by the ultrasonic sensor setter methods. There is an example coming with the coderacer libary that you can load and get an idea how that works. \begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 314 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
314 \{
315 start\_stop\_at\_min\_distance(\_usonic\_stop\_distance\_cm);
316 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga64bc1b2a8ed5bc3ec5e706fa70a1385d}\label{group__higherlevelmeths_ga64bc1b2a8ed5bc3ec5e706fa70a1385d}}
\index{Methods@{Methods}!start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}}
\index{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}!Methods@{Methods}}
\subsubsection{\texorpdfstring{start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance()}{start\_stop\_at\_min\_distance()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Code\+Racer\+::start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance (\begin{DoxyParamCaption}\item[{unsigned long}]{min\+\_\+distance\+\_\+cm }\end{DoxyParamCaption})}
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance.
This is almos the same as described for start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance(). You can specify the distance in cm here -\/ this value will be stored internally and used by start\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance() next time.
\begin{DoxyParams}{Parameters}
{\em min\+\_\+distance\+\_\+cm} & the minimal disctance in cm \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 324 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
324 \{
325 \textcolor{keywordflow}{if} (\textcolor{keyword}{false} == \_coderacer\_stop\_at\_distance\_enabled) \{
326 \_coderacer\_stopped\_at\_min\_distance = \textcolor{keyword}{false};
327 usonic\_set\_stop\_distance\_cm(min\_distance\_cm);
328 \_coderacer\_stop\_at\_distance\_enabled = \textcolor{keyword}{true};
329 \}
330 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_gac664109241d08b8dc52db5721f394b22}\label{group__higherlevelmeths_gac664109241d08b8dc52db5721f394b22}}
\index{Methods@{Methods}!stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}}
\index{stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance@{stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance}!Methods@{Methods}}
\subsubsection{\texorpdfstring{stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance()}{stop\_stop\_at\_min\_distance()}}
{\footnotesize\ttfamily void Code\+Racer\+::stop\+\_\+stop\+\_\+at\+\_\+min\+\_\+distance (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Disables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance.
\begin{DoxyReturn}{Returns}
nothing
\end{DoxyReturn}
Definition at line 335 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
335 \{
336 \_coderacer\_stop\_at\_distance\_enabled = \textcolor{keyword}{false};
337 \}
\end{DoxyCode}
\mbox{\Hypertarget{group__higherlevelmeths_ga34e2fe2123e76fd844482dfef6c5a9c8}\label{group__higherlevelmeths_ga34e2fe2123e76fd844482dfef6c5a9c8}}
\index{Methods@{Methods}!start\+\_\+stop@{start\+\_\+stop}}
\index{start\+\_\+stop@{start\+\_\+stop}!Methods@{Methods}}
\subsubsection{\texorpdfstring{start\+\_\+stop()}{start\_stop()}}
{\footnotesize\ttfamily bool Code\+Racer\+::start\+\_\+stop (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
This will return if the codracer is in active mode or not.
There is a button used to toogle between active and inactive each time it is pressed This may help you to start driving and scanning the distance by pressing the button -\/ and as well to stop the racer by pressing the button. This method will set the L\+E\+Ds depending on the mode and sets the servo back to center and stopps the racer when leaving the active mode. You can leave or enter the active mode as well by setting using set\+\_\+active() and set\+\_\+inactive(). The button itself triggers and internall interrupt event and sets the active state -\/ but you have to continously call that method to switch between inactive and active mode depending on the active state. If in inactive mode and fun is enabeld by just setting the coderacer\+\_\+fun\+\_\+enabled = true ... some fun will happen \+:-\/)
\begin{DoxyReturn}{Returns}
True if the coderacer is in active mode. False if in inactive mode.
\end{DoxyReturn}
Definition at line 348 of file Code\+Racer.\+cpp.
\begin{DoxyCode}
348 \{
349 \textcolor{keywordflow}{if} (\_coderracer\_activ != coderracer\_activ) \{
350 \_coderracer\_activ = coderracer\_activ;
351 \textcolor{keywordflow}{if} (\textcolor{keyword}{true} == \_coderracer\_activ) \{
352 set\_leds\_all\_off();
353 delay(500);
354 \}
355 \textcolor{keywordflow}{else} \{
356 stop\_driving();
357 set\_leds\_all\_on();
358 delay(200);
359 servo\_set\_to\_center();
360 \_servo\_look\_around\_at\_ms = millis() + random(20000, 120000);
361 \}
362 \}
363
364 \textcolor{keywordflow}{if} ((\textcolor{keyword}{false} == \_coderracer\_activ) && (\textcolor{keyword}{true} == coderacer\_fun\_enabled)) \{
365 kitt();
366 look\_around();
367 \}
368
369 \textcolor{keywordflow}{return}(\_coderracer\_activ);
370 \}
\end{DoxyCode}