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 Jun 19 10:00:41 2013 +0000
Revision:
0:da22b0b4395a
mbed robotracer for education ver 1.0

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_LOCALFILESYSTEM_H
hayama 0:da22b0b4395a 17 #define MBED_LOCALFILESYSTEM_H
hayama 0:da22b0b4395a 18
hayama 0:da22b0b4395a 19 #include "platform.h"
hayama 0:da22b0b4395a 20
hayama 0:da22b0b4395a 21 #if DEVICE_LOCALFILESYSTEM
hayama 0:da22b0b4395a 22
hayama 0:da22b0b4395a 23 #include "FileSystemLike.h"
hayama 0:da22b0b4395a 24
hayama 0:da22b0b4395a 25 namespace mbed {
hayama 0:da22b0b4395a 26
hayama 0:da22b0b4395a 27 FILEHANDLE local_file_open(const char* name, int flags);
hayama 0:da22b0b4395a 28
hayama 0:da22b0b4395a 29 class LocalFileHandle : public FileHandle {
hayama 0:da22b0b4395a 30
hayama 0:da22b0b4395a 31 public:
hayama 0:da22b0b4395a 32 LocalFileHandle(FILEHANDLE fh);
hayama 0:da22b0b4395a 33
hayama 0:da22b0b4395a 34 virtual int close();
hayama 0:da22b0b4395a 35
hayama 0:da22b0b4395a 36 virtual ssize_t write(const void *buffer, size_t length);
hayama 0:da22b0b4395a 37
hayama 0:da22b0b4395a 38 virtual ssize_t read(void *buffer, size_t length);
hayama 0:da22b0b4395a 39
hayama 0:da22b0b4395a 40 virtual int isatty();
hayama 0:da22b0b4395a 41
hayama 0:da22b0b4395a 42 virtual off_t lseek(off_t position, int whence);
hayama 0:da22b0b4395a 43
hayama 0:da22b0b4395a 44 virtual int fsync();
hayama 0:da22b0b4395a 45
hayama 0:da22b0b4395a 46 virtual off_t flen();
hayama 0:da22b0b4395a 47
hayama 0:da22b0b4395a 48 protected:
hayama 0:da22b0b4395a 49 FILEHANDLE _fh;
hayama 0:da22b0b4395a 50 int pos;
hayama 0:da22b0b4395a 51 };
hayama 0:da22b0b4395a 52
hayama 0:da22b0b4395a 53 /** A filesystem for accessing the local mbed Microcontroller USB disk drive
hayama 0:da22b0b4395a 54 *
hayama 0:da22b0b4395a 55 * This allows programs to read and write files on the same disk drive that is used to program the
hayama 0:da22b0b4395a 56 * mbed Microcontroller. Once created, the standard C file access functions are used to open,
hayama 0:da22b0b4395a 57 * read and write files.
hayama 0:da22b0b4395a 58 *
hayama 0:da22b0b4395a 59 * Example:
hayama 0:da22b0b4395a 60 * @code
hayama 0:da22b0b4395a 61 * #include "mbed.h"
hayama 0:da22b0b4395a 62 *
hayama 0:da22b0b4395a 63 * LocalFileSystem local("local"); // Create the local filesystem under the name "local"
hayama 0:da22b0b4395a 64 *
hayama 0:da22b0b4395a 65 * int main() {
hayama 0:da22b0b4395a 66 * FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
hayama 0:da22b0b4395a 67 * fprintf(fp, "Hello World!");
hayama 0:da22b0b4395a 68 * fclose(fp);
hayama 0:da22b0b4395a 69 * remove("/local/out.txt"); // Removes the file "out.txt" from the local file system
hayama 0:da22b0b4395a 70 *
hayama 0:da22b0b4395a 71 * DIR *d = opendir("/local"); // Opens the root directory of the local file system
hayama 0:da22b0b4395a 72 * struct dirent *p;
hayama 0:da22b0b4395a 73 * while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
hayama 0:da22b0b4395a 74 * printf("%s\n", p->d_name); // to stdout.
hayama 0:da22b0b4395a 75 * }
hayama 0:da22b0b4395a 76 * closedir(d);
hayama 0:da22b0b4395a 77 * }
hayama 0:da22b0b4395a 78 * @endcode
hayama 0:da22b0b4395a 79 *
hayama 0:da22b0b4395a 80 * @note
hayama 0:da22b0b4395a 81 * If the microcontroller program makes an access to the local drive, it will be marked as "removed"
hayama 0:da22b0b4395a 82 * on the Host computer. This means it is no longer accessible from the Host Computer.
hayama 0:da22b0b4395a 83 *
hayama 0:da22b0b4395a 84 * The drive will only re-appear when the microcontroller program exists. Note that if the program does
hayama 0:da22b0b4395a 85 * not exit, you will need to hold down reset on the mbed Microcontroller to be able to see the drive again!
hayama 0:da22b0b4395a 86 */
hayama 0:da22b0b4395a 87 class LocalFileSystem : public FileSystemLike {
hayama 0:da22b0b4395a 88
hayama 0:da22b0b4395a 89 public:
hayama 0:da22b0b4395a 90 LocalFileSystem(const char* n) : FileSystemLike(n) {
hayama 0:da22b0b4395a 91
hayama 0:da22b0b4395a 92 }
hayama 0:da22b0b4395a 93
hayama 0:da22b0b4395a 94 virtual FileHandle *open(const char* name, int flags);
hayama 0:da22b0b4395a 95 virtual int remove(const char *filename);
hayama 0:da22b0b4395a 96 virtual DirHandle *opendir(const char *name);
hayama 0:da22b0b4395a 97 };
hayama 0:da22b0b4395a 98
hayama 0:da22b0b4395a 99 } // namespace mbed
hayama 0:da22b0b4395a 100
hayama 0:da22b0b4395a 101 #endif
hayama 0:da22b0b4395a 102
hayama 0:da22b0b4395a 103 #endif