mbed robotracer for education.

Robotracer (line follower robot ) using stepper motor.

/media/uploads/hayama/cimg8463.jpg

/media/uploads/hayama/mbedrobotracer-manual-english.pdf

/media/uploads/hayama/mbedrobotracer-manual-japanese.pdf

/media/uploads/hayama/eagle-design-robotracer.zip

movie -> https://www.youtube.com/watch?v=INwun8gSds4

(for competition->) https://www.youtube.com/watch?v=l_gP2pUt4w0

Committer:
hayama
Date:
Wed Oct 02 01:09:55 2013 +0000
Revision:
1:200aad416161
Parent:
0:da22b0b4395a
mbed robotracer for education.
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hayama 0:da22b0b4395a 1 /* mbed Microcontroller Library
hayama 0:da22b0b4395a 2 * Copyright (c) 2006-2013 ARM Limited
hayama 0:da22b0b4395a 3 *
hayama 0:da22b0b4395a 4 * Licensed under the Apache License, Version 2.0 (the "License");
hayama 0:da22b0b4395a 5 * you may not use this file except in compliance with the License.
hayama 0:da22b0b4395a 6 * You may obtain a copy of the License at
hayama 0:da22b0b4395a 7 *
hayama 0:da22b0b4395a 8 * http://www.apache.org/licenses/LICENSE-2.0
hayama 0:da22b0b4395a 9 *
hayama 0:da22b0b4395a 10 * Unless required by applicable law or agreed to in writing, software
hayama 0:da22b0b4395a 11 * distributed under the License is distributed on an "AS IS" BASIS,
hayama 0:da22b0b4395a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
hayama 0:da22b0b4395a 13 * See the License for the specific language governing permissions and
hayama 0:da22b0b4395a 14 * limitations under the License.
hayama 0:da22b0b4395a 15 */
hayama 0:da22b0b4395a 16 #ifndef MBED_DIRHANDLE_H
hayama 0:da22b0b4395a 17 #define MBED_DIRHANDLE_H
hayama 0:da22b0b4395a 18
hayama 0:da22b0b4395a 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
hayama 0:da22b0b4395a 20 # define NAME_MAX 255
hayama 0:da22b0b4395a 21 typedef int mode_t;
hayama 0:da22b0b4395a 22
hayama 0:da22b0b4395a 23 #else
hayama 0:da22b0b4395a 24 # include <sys/syslimits.h>
hayama 0:da22b0b4395a 25 #endif
hayama 0:da22b0b4395a 26
hayama 0:da22b0b4395a 27 #include "FileHandle.h"
hayama 0:da22b0b4395a 28
hayama 0:da22b0b4395a 29 struct dirent {
hayama 0:da22b0b4395a 30 char d_name[NAME_MAX+1];
hayama 0:da22b0b4395a 31 };
hayama 0:da22b0b4395a 32
hayama 0:da22b0b4395a 33 namespace mbed {
hayama 0:da22b0b4395a 34
hayama 0:da22b0b4395a 35 /** Represents a directory stream. Objects of this type are returned
hayama 0:da22b0b4395a 36 * by a FileSystemLike's opendir method. Implementations must define
hayama 0:da22b0b4395a 37 * at least closedir, readdir and rewinddir.
hayama 0:da22b0b4395a 38 *
hayama 0:da22b0b4395a 39 * If a FileSystemLike class defines the opendir method, then the
hayama 0:da22b0b4395a 40 * directories of an object of that type can be accessed by
hayama 0:da22b0b4395a 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
hayama 0:da22b0b4395a 42 * to open the root of the filesystem), and then using readdir(d) etc.
hayama 0:da22b0b4395a 43 *
hayama 0:da22b0b4395a 44 * The root directory is considered to contain all FileLike and
hayama 0:da22b0b4395a 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
hayama 0:da22b0b4395a 46 * reflect this.
hayama 0:da22b0b4395a 47 */
hayama 0:da22b0b4395a 48 class DirHandle {
hayama 0:da22b0b4395a 49
hayama 0:da22b0b4395a 50 public:
hayama 0:da22b0b4395a 51 /** Closes the directory.
hayama 0:da22b0b4395a 52 *
hayama 0:da22b0b4395a 53 * @returns
hayama 0:da22b0b4395a 54 * 0 on success,
hayama 0:da22b0b4395a 55 * -1 on error.
hayama 0:da22b0b4395a 56 */
hayama 0:da22b0b4395a 57 virtual int closedir()=0;
hayama 0:da22b0b4395a 58
hayama 0:da22b0b4395a 59 /** Return the directory entry at the current position, and
hayama 0:da22b0b4395a 60 * advances the position to the next entry.
hayama 0:da22b0b4395a 61 *
hayama 0:da22b0b4395a 62 * @returns
hayama 0:da22b0b4395a 63 * A pointer to a dirent structure representing the
hayama 0:da22b0b4395a 64 * directory entry at the current position, or NULL on reaching
hayama 0:da22b0b4395a 65 * end of directory or error.
hayama 0:da22b0b4395a 66 */
hayama 0:da22b0b4395a 67 virtual struct dirent *readdir()=0;
hayama 0:da22b0b4395a 68
hayama 0:da22b0b4395a 69 /** Resets the position to the beginning of the directory.
hayama 0:da22b0b4395a 70 */
hayama 0:da22b0b4395a 71 virtual void rewinddir()=0;
hayama 0:da22b0b4395a 72
hayama 0:da22b0b4395a 73 /** Returns the current position of the DirHandle.
hayama 0:da22b0b4395a 74 *
hayama 0:da22b0b4395a 75 * @returns
hayama 0:da22b0b4395a 76 * the current position,
hayama 0:da22b0b4395a 77 * -1 on error.
hayama 0:da22b0b4395a 78 */
hayama 0:da22b0b4395a 79 virtual off_t telldir() { return -1; }
hayama 0:da22b0b4395a 80
hayama 0:da22b0b4395a 81 /** Sets the position of the DirHandle.
hayama 0:da22b0b4395a 82 *
hayama 0:da22b0b4395a 83 * @param location The location to seek to. Must be a value returned by telldir.
hayama 0:da22b0b4395a 84 */
hayama 0:da22b0b4395a 85 virtual void seekdir(off_t location) { }
hayama 0:da22b0b4395a 86
hayama 0:da22b0b4395a 87 virtual ~DirHandle() {}
hayama 0:da22b0b4395a 88 };
hayama 0:da22b0b4395a 89
hayama 0:da22b0b4395a 90 } // namespace mbed
hayama 0:da22b0b4395a 91
hayama 0:da22b0b4395a 92 typedef mbed::DirHandle DIR;
hayama 0:da22b0b4395a 93
hayama 0:da22b0b4395a 94 extern "C" {
hayama 0:da22b0b4395a 95 DIR *opendir(const char*);
hayama 0:da22b0b4395a 96 struct dirent *readdir(DIR *);
hayama 0:da22b0b4395a 97 int closedir(DIR*);
hayama 0:da22b0b4395a 98 void rewinddir(DIR*);
hayama 0:da22b0b4395a 99 long telldir(DIR*);
hayama 0:da22b0b4395a 100 void seekdir(DIR*, long);
hayama 0:da22b0b4395a 101 int mkdir(const char *name, mode_t n);
hayama 0:da22b0b4395a 102 };
hayama 0:da22b0b4395a 103
hayama 0:da22b0b4395a 104 #endif /* MBED_DIRHANDLE_H */