This is a Shield Bot Library
Fork of Shield_Bot_v12 by
ShieldBot_v12.h@1:1d96ab1dbcc4, 2015-09-15 (annotated)
- Committer:
- Kevin_Lee
- Date:
- Tue Sep 15 13:40:55 2015 +0000
- Revision:
- 1:1d96ab1dbcc4
- Parent:
- 0:7535295d1670
This is a library for ShieldBot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kevin_Lee | 1:1d96ab1dbcc4 | 1 | /* |
Kevin_Lee | 1:1d96ab1dbcc4 | 2 | * ShieldBot_v12.h |
Kevin_Lee | 1:1d96ab1dbcc4 | 3 | * A library for ShieldBot |
Kevin_Lee | 1:1d96ab1dbcc4 | 4 | * |
Kevin_Lee | 1:1d96ab1dbcc4 | 5 | * Copyright (c) 2015 seeed technology inc. |
Kevin_Lee | 1:1d96ab1dbcc4 | 6 | * Author : Jiankai.li |
Kevin_Lee | 1:1d96ab1dbcc4 | 7 | * Create Time: Sep 2015 |
Kevin_Lee | 1:1d96ab1dbcc4 | 8 | * Change Log : |
Kevin_Lee | 0:7535295d1670 | 9 | * |
Kevin_Lee | 0:7535295d1670 | 10 | * The MIT License (MIT) |
Kevin_Lee | 0:7535295d1670 | 11 | * |
Kevin_Lee | 0:7535295d1670 | 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
Kevin_Lee | 0:7535295d1670 | 13 | * of this software and associated documentation files (the "Software"), to deal |
Kevin_Lee | 0:7535295d1670 | 14 | * in the Software without restriction, including without limitation the rights |
Kevin_Lee | 0:7535295d1670 | 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
Kevin_Lee | 0:7535295d1670 | 16 | * copies of the Software, and to permit persons to whom the Software is |
Kevin_Lee | 0:7535295d1670 | 17 | * furnished to do so, subject to the following conditions: |
Kevin_Lee | 1:1d96ab1dbcc4 | 18 | * |
Kevin_Lee | 0:7535295d1670 | 19 | * The above copyright notice and this permission notice shall be included in |
Kevin_Lee | 0:7535295d1670 | 20 | * all copies or substantial portions of the Software. |
Kevin_Lee | 1:1d96ab1dbcc4 | 21 | * |
Kevin_Lee | 0:7535295d1670 | 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Kevin_Lee | 0:7535295d1670 | 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Kevin_Lee | 0:7535295d1670 | 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Kevin_Lee | 0:7535295d1670 | 25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Kevin_Lee | 0:7535295d1670 | 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Kevin_Lee | 0:7535295d1670 | 27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
Kevin_Lee | 0:7535295d1670 | 28 | * THE SOFTWARE. |
Kevin_Lee | 0:7535295d1670 | 29 | */ |
Kevin_Lee | 0:7535295d1670 | 30 | |
Kevin_Lee | 1:1d96ab1dbcc4 | 31 | |
Kevin_Lee | 1:1d96ab1dbcc4 | 32 | // ensure this library description is only included once |
Kevin_Lee | 1:1d96ab1dbcc4 | 33 | |
Kevin_Lee | 0:7535295d1670 | 34 | #ifndef __SHIELDBOT_V12_H__ |
Kevin_Lee | 0:7535295d1670 | 35 | #define __SHIELDBOT_V12_H__ |
Kevin_Lee | 0:7535295d1670 | 36 | |
Kevin_Lee | 0:7535295d1670 | 37 | #include <stdint.h> |
Kevin_Lee | 0:7535295d1670 | 38 | |
Kevin_Lee | 0:7535295d1670 | 39 | |
Kevin_Lee | 0:7535295d1670 | 40 | /** Color pixels class using WS2812B and nRF51822 (16Hz) |
Kevin_Lee | 0:7535295d1670 | 41 | * |
Kevin_Lee | 0:7535295d1670 | 42 | * Example: |
Kevin_Lee | 0:7535295d1670 | 43 | * @code |
Kevin_Lee | 0:7535295d1670 | 44 | * #include "mbed.h" |
Kevin_Lee | 0:7535295d1670 | 45 | * #include "color_pixels.h" |
Kevin_Lee | 0:7535295d1670 | 46 | * |
Kevin_Lee | 0:7535295d1670 | 47 | * ColorPixels pixels(1, 32); |
Kevin_Lee | 0:7535295d1670 | 48 | * |
Kevin_Lee | 0:7535295d1670 | 49 | * int main() { |
Kevin_Lee | 0:7535295d1670 | 50 | * pixels.set_color(0, 0, 255, 0); |
Kevin_Lee | 0:7535295d1670 | 51 | * pixels.update(); |
Kevin_Lee | 0:7535295d1670 | 52 | * |
Kevin_Lee | 0:7535295d1670 | 53 | * while(1) { |
Kevin_Lee | 0:7535295d1670 | 54 | * } |
Kevin_Lee | 0:7535295d1670 | 55 | * } |
Kevin_Lee | 0:7535295d1670 | 56 | * @endcode |
Kevin_Lee | 0:7535295d1670 | 57 | */ |
Kevin_Lee | 1:1d96ab1dbcc4 | 58 | |
Kevin_Lee | 1:1d96ab1dbcc4 | 59 | // library interface description |
Kevin_Lee | 1:1d96ab1dbcc4 | 60 | class Shieldbot |
Kevin_Lee | 0:7535295d1670 | 61 | { |
Kevin_Lee | 1:1d96ab1dbcc4 | 62 | // user-accessible "public" interface |
Kevin_Lee | 1:1d96ab1dbcc4 | 63 | public: |
Kevin_Lee | 1:1d96ab1dbcc4 | 64 | Shieldbot(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 65 | int readS1(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 66 | int readS2(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 67 | int readS3(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 68 | int readS4(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 69 | int readS5(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 70 | void setMaxSpeed(int); |
Kevin_Lee | 1:1d96ab1dbcc4 | 71 | void setMaxSpeed(int, int); |
Kevin_Lee | 1:1d96ab1dbcc4 | 72 | void setMaxLeftSpeed(int); |
Kevin_Lee | 1:1d96ab1dbcc4 | 73 | void setMaxRightSpeed(int); |
Kevin_Lee | 1:1d96ab1dbcc4 | 74 | void rightMotor(signed char); |
Kevin_Lee | 1:1d96ab1dbcc4 | 75 | void leftMotor(signed char); |
Kevin_Lee | 1:1d96ab1dbcc4 | 76 | void drive(signed char, signed char); |
Kevin_Lee | 1:1d96ab1dbcc4 | 77 | void forward(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 78 | void backward(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 79 | void stop(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 80 | void stopRight(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 81 | void stopLeft(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 82 | void fastStopLeft(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 83 | void fastStopRight(); |
Kevin_Lee | 1:1d96ab1dbcc4 | 84 | void fastStop(); |
Kevin_Lee | 0:7535295d1670 | 85 | |
Kevin_Lee | 0:7535295d1670 | 86 | }; |
Kevin_Lee | 0:7535295d1670 | 87 | |
Kevin_Lee | 1:1d96ab1dbcc4 | 88 | #endif |