mbed robotracer for education.
Robotracer (line follower robot ) using stepper motor.
/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
mbed/Timeout.h@1:200aad416161, 2013-10-02 (annotated)
- 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?
User | Revision | Line number | New 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_TIMEOUT_H |
hayama | 0:da22b0b4395a | 17 | #define MBED_TIMEOUT_H |
hayama | 0:da22b0b4395a | 18 | |
hayama | 0:da22b0b4395a | 19 | #include "Ticker.h" |
hayama | 0:da22b0b4395a | 20 | |
hayama | 0:da22b0b4395a | 21 | namespace mbed { |
hayama | 0:da22b0b4395a | 22 | |
hayama | 0:da22b0b4395a | 23 | /** A Timeout is used to call a function at a point in the future |
hayama | 0:da22b0b4395a | 24 | * |
hayama | 0:da22b0b4395a | 25 | * You can use as many seperate Timeout objects as you require. |
hayama | 0:da22b0b4395a | 26 | * |
hayama | 0:da22b0b4395a | 27 | * Example: |
hayama | 0:da22b0b4395a | 28 | * @code |
hayama | 0:da22b0b4395a | 29 | * // Blink until timeout. |
hayama | 0:da22b0b4395a | 30 | * |
hayama | 0:da22b0b4395a | 31 | * #include "mbed.h" |
hayama | 0:da22b0b4395a | 32 | * |
hayama | 0:da22b0b4395a | 33 | * Timeout timeout; |
hayama | 0:da22b0b4395a | 34 | * DigitalOut led(LED1); |
hayama | 0:da22b0b4395a | 35 | * |
hayama | 0:da22b0b4395a | 36 | * int on = 1; |
hayama | 0:da22b0b4395a | 37 | * |
hayama | 0:da22b0b4395a | 38 | * void attimeout() { |
hayama | 0:da22b0b4395a | 39 | * on = 0; |
hayama | 0:da22b0b4395a | 40 | * } |
hayama | 0:da22b0b4395a | 41 | * |
hayama | 0:da22b0b4395a | 42 | * int main() { |
hayama | 0:da22b0b4395a | 43 | * timeout.attach(&attimeout, 5); |
hayama | 0:da22b0b4395a | 44 | * while(on) { |
hayama | 0:da22b0b4395a | 45 | * led = !led; |
hayama | 0:da22b0b4395a | 46 | * wait(0.2); |
hayama | 0:da22b0b4395a | 47 | * } |
hayama | 0:da22b0b4395a | 48 | * } |
hayama | 0:da22b0b4395a | 49 | * @endcode |
hayama | 0:da22b0b4395a | 50 | */ |
hayama | 0:da22b0b4395a | 51 | class Timeout : public Ticker { |
hayama | 0:da22b0b4395a | 52 | |
hayama | 0:da22b0b4395a | 53 | protected: |
hayama | 0:da22b0b4395a | 54 | virtual void handler(); |
hayama | 0:da22b0b4395a | 55 | }; |
hayama | 0:da22b0b4395a | 56 | |
hayama | 0:da22b0b4395a | 57 | } // namespace mbed |
hayama | 0:da22b0b4395a | 58 | |
hayama | 0:da22b0b4395a | 59 | #endif |