C++ Library for the PsiSwarm Robot - Version 0.8
Dependents: PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk
Fork of PsiSwarmV7_CPP by
animations.h@12:878c6e9d9e60, 2016-10-17 (annotated)
- Committer:
- jah128
- Date:
- Mon Oct 17 13:09:10 2016 +0000
- Revision:
- 12:878c6e9d9e60
- Parent:
- dances.h@11:312663037b8c
Added Psiswarm class; changed Dances to Animations
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 12:878c6e9d9e60 | 1 | /* University of York Robotics Laboratory PsiSwarm Library: Animations Header File |
jah128 | 0:d6269d17c8cf | 2 | * |
jah128 | 6:b340a527add9 | 3 | * Copyright 2016 University of York |
jah128 | 6:b340a527add9 | 4 | * |
jah128 | 6:b340a527add9 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |
jah128 | 6:b340a527add9 | 6 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
jah128 | 6:b340a527add9 | 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS |
jah128 | 6:b340a527add9 | 8 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jah128 | 6:b340a527add9 | 9 | * See the License for the specific language governing permissions and limitations under the License. |
jah128 | 6:b340a527add9 | 10 | * |
jah128 | 0:d6269d17c8cf | 11 | * Library of simple predetermined movements |
jah128 | 0:d6269d17c8cf | 12 | * |
jah128 | 12:878c6e9d9e60 | 13 | * File: animations.h |
jah128 | 12:878c6e9d9e60 | 14 | * [Was dances.h in version 0.7] |
jah128 | 0:d6269d17c8cf | 15 | * |
jah128 | 0:d6269d17c8cf | 16 | * (C) Dept. Electronics & Computer Science, University of York |
jah128 | 0:d6269d17c8cf | 17 | * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis |
jah128 | 0:d6269d17c8cf | 18 | * |
jah128 | 11:312663037b8c | 19 | * PsiSwarm Library Version: 0.8 |
jah128 | 0:d6269d17c8cf | 20 | * |
jah128 | 5:3cdd1a37cdd7 | 21 | * October 2016 |
jah128 | 0:d6269d17c8cf | 22 | * |
jah128 | 0:d6269d17c8cf | 23 | * |
jah128 | 0:d6269d17c8cf | 24 | */ |
jah128 | 0:d6269d17c8cf | 25 | |
jah128 | 12:878c6e9d9e60 | 26 | #ifndef ANIMATIONS_H |
jah128 | 12:878c6e9d9e60 | 27 | #define ANIMATIONS_H |
jah128 | 0:d6269d17c8cf | 28 | |
jah128 | 11:312663037b8c | 29 | /** |
jah128 | 12:878c6e9d9e60 | 30 | * The Animations class contains simple predefined LED animations and dances |
jah128 | 11:312663037b8c | 31 | */ |
jah128 | 12:878c6e9d9e60 | 32 | class Animations{ |
jah128 | 11:312663037b8c | 33 | public: |
jah128 | 11:312663037b8c | 34 | /** |
jah128 | 11:312663037b8c | 35 | * Make the robot vibrate (turn rapidly left & right) for approximately 1 second with LED flashes; restores LED states after action |
jah128 | 11:312663037b8c | 36 | */ |
jah128 | 11:312663037b8c | 37 | void vibrate(void); |
jah128 | 12:878c6e9d9e60 | 38 | |
jah128 | 12:878c6e9d9e60 | 39 | /** |
jah128 | 12:878c6e9d9e60 | 40 | * Patterns LEDs from back to front of robot 3 times then blinks at the front; animation takes about 1 second; restores LED states after action |
jah128 | 12:878c6e9d9e60 | 41 | */ |
jah128 | 12:878c6e9d9e60 | 42 | void led_run1(void); |
jah128 | 12:878c6e9d9e60 | 43 | |
jah128 | 12:878c6e9d9e60 | 44 | /** |
jah128 | 12:878c6e9d9e60 | 45 | * Sets the colour for single-colour LED animations (default = 1) |
jah128 | 12:878c6e9d9e60 | 46 | * @param colour The colour LED to use in the animation (1 = red, 2 = green, 3 = orange) |
jah128 | 12:878c6e9d9e60 | 47 | */ |
jah128 | 12:878c6e9d9e60 | 48 | void set_colour(char colour); |
jah128 | 12:878c6e9d9e60 | 49 | |
jah128 | 12:878c6e9d9e60 | 50 | private: |
jah128 | 12:878c6e9d9e60 | 51 | char hold_colour; |
jah128 | 12:878c6e9d9e60 | 52 | char animation_counter; |
jah128 | 12:878c6e9d9e60 | 53 | Timeout animation_timeout; |
jah128 | 11:312663037b8c | 54 | }; |
jah128 | 0:d6269d17c8cf | 55 | |
jah128 | 0:d6269d17c8cf | 56 | #endif |