![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
StateChart defining behavior for FlippityFlappity project
Dependencies: MMA8451Q Multi_WS2811 TSI mbed
statechart.h@0:e72b30045834, 2015-04-06 (annotated)
- Committer:
- ryanfeng
- Date:
- Mon Apr 06 20:27:47 2015 +0000
- Revision:
- 0:e72b30045834
Original StateChart for FlippityFlappity. Find presentation statechart in FishStateChartDemo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryanfeng | 0:e72b30045834 | 1 | #ifndef STATECHART_H |
ryanfeng | 0:e72b30045834 | 2 | #define STATECHART_H |
ryanfeng | 0:e72b30045834 | 3 | |
ryanfeng | 0:e72b30045834 | 4 | #define MINBRITE (0.2) |
ryanfeng | 0:e72b30045834 | 5 | #define MAXBRITE (0.5) |
ryanfeng | 0:e72b30045834 | 6 | #define PI (3.141592653589793) |
ryanfeng | 0:e72b30045834 | 7 | |
ryanfeng | 0:e72b30045834 | 8 | class Statechart{ |
ryanfeng | 0:e72b30045834 | 9 | public: |
ryanfeng | 0:e72b30045834 | 10 | enum actState_t { |
ryanfeng | 0:e72b30045834 | 11 | REST, |
ryanfeng | 0:e72b30045834 | 12 | LOOK_LEFT, |
ryanfeng | 0:e72b30045834 | 13 | LOOK_RIGHT, |
ryanfeng | 0:e72b30045834 | 14 | FLOP, |
ryanfeng | 0:e72b30045834 | 15 | WALK, |
ryanfeng | 0:e72b30045834 | 16 | FLAP, |
ryanfeng | 0:e72b30045834 | 17 | BATTERY_LOW |
ryanfeng | 0:e72b30045834 | 18 | }; |
ryanfeng | 0:e72b30045834 | 19 | |
ryanfeng | 0:e72b30045834 | 20 | enum emoState_t { |
ryanfeng | 0:e72b30045834 | 21 | CURIOUS, |
ryanfeng | 0:e72b30045834 | 22 | MAD, |
ryanfeng | 0:e72b30045834 | 23 | HAPPY, |
ryanfeng | 0:e72b30045834 | 24 | SAD |
ryanfeng | 0:e72b30045834 | 25 | }; |
ryanfeng | 0:e72b30045834 | 26 | |
ryanfeng | 0:e72b30045834 | 27 | void fishStatechart(int netTime, int capNum, int prox, float* xyz, Serial &maestro, WS2811 &lightStrip1, WS2811 &lightStrip2, float battery); |
ryanfeng | 0:e72b30045834 | 28 | |
ryanfeng | 0:e72b30045834 | 29 | private: |
ryanfeng | 0:e72b30045834 | 30 | void showRainbow(WS2811 &strip, float sat, float brite, float hueShift); |
ryanfeng | 0:e72b30045834 | 31 | void showSolidColor(WS2811 &strip, uint8_t r, uint8_t g, uint8_t b); |
ryanfeng | 0:e72b30045834 | 32 | void showSolidColorBright(WS2811 &strip, uint8_t r, uint8_t g, uint8_t b, float newBrite); |
ryanfeng | 0:e72b30045834 | 33 | void showSomeRainbow(WS2811 &strip, float hueLow, float hueHigh, float sat, float brite); |
ryanfeng | 0:e72b30045834 | 34 | void setMaestroSubroutine(Serial &maestro, int subNum, int parameter, bool withParameter); |
ryanfeng | 0:e72b30045834 | 35 | void setServoValue(Serial &maestro, int index, uint16_t x0, uint16_t x1, uint16_t x2); |
ryanfeng | 0:e72b30045834 | 36 | }; |
ryanfeng | 0:e72b30045834 | 37 | |
ryanfeng | 0:e72b30045834 | 38 | #endif |