The Location Puck gives your smartphone context about its location. Built on the Puck IOT platform.
The location puck will give your smartphone context about the phone’s location. You can later set up rules for what should happen at different locations in the smartphone companion application (Puck Central).
A tutorial for the Location Puck is available on GitHub.
Tutorials and in-depth documentation for the Puck platform is available at the project's GitHub page
main.cpp@0:f4fbeaabdff5, 2014-06-19 (annotated)
- Committer:
- cristea
- Date:
- Thu Jun 19 08:28:07 2014 +0000
- Revision:
- 0:f4fbeaabdff5
- Child:
- 1:345039810771
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cristea | 0:f4fbeaabdff5 | 1 | #include <mbed.h> |
cristea | 0:f4fbeaabdff5 | 2 | |
cristea | 0:f4fbeaabdff5 | 3 | DigitalOut led1(LED1); |
cristea | 0:f4fbeaabdff5 | 4 | DigitalOut led2(LED2); |
cristea | 0:f4fbeaabdff5 | 5 | |
cristea | 0:f4fbeaabdff5 | 6 | void clear() { |
cristea | 0:f4fbeaabdff5 | 7 | led1 = 0; |
cristea | 0:f4fbeaabdff5 | 8 | led2 = 0; |
cristea | 0:f4fbeaabdff5 | 9 | } |
cristea | 0:f4fbeaabdff5 | 10 | |
cristea | 0:f4fbeaabdff5 | 11 | void cycle(float delta) { |
cristea | 0:f4fbeaabdff5 | 12 | clear(); |
cristea | 0:f4fbeaabdff5 | 13 | led1 = 1; |
cristea | 0:f4fbeaabdff5 | 14 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 15 | |
cristea | 0:f4fbeaabdff5 | 16 | clear(); |
cristea | 0:f4fbeaabdff5 | 17 | led2 = 1; |
cristea | 0:f4fbeaabdff5 | 18 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 19 | |
cristea | 0:f4fbeaabdff5 | 20 | clear(); |
cristea | 0:f4fbeaabdff5 | 21 | led3 = 1; |
cristea | 0:f4fbeaabdff5 | 22 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 23 | |
cristea | 0:f4fbeaabdff5 | 24 | clear(); |
cristea | 0:f4fbeaabdff5 | 25 | led4 = 1; |
cristea | 0:f4fbeaabdff5 | 26 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 27 | } |
cristea | 0:f4fbeaabdff5 | 28 | |
cristea | 0:f4fbeaabdff5 | 29 | void drums(float delta) { |
cristea | 0:f4fbeaabdff5 | 30 | clear(); |
cristea | 0:f4fbeaabdff5 | 31 | led1 = 1; |
cristea | 0:f4fbeaabdff5 | 32 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 33 | |
cristea | 0:f4fbeaabdff5 | 34 | clear(); |
cristea | 0:f4fbeaabdff5 | 35 | led4 = 1; |
cristea | 0:f4fbeaabdff5 | 36 | wait(delta); |
cristea | 0:f4fbeaabdff5 | 37 | } |
cristea | 0:f4fbeaabdff5 | 38 | |
cristea | 0:f4fbeaabdff5 | 39 | int main() { |
cristea | 0:f4fbeaabdff5 | 40 | while(1) { |
cristea | 0:f4fbeaabdff5 | 41 | drums(0.3); |
cristea | 0:f4fbeaabdff5 | 42 | } |
cristea | 0:f4fbeaabdff5 | 43 | } |