Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@9:724d3e39ded8, 2015-06-01 (annotated)
- Committer:
- darzento
- Date:
- Mon Jun 01 10:21:18 2015 +0000
- Revision:
- 9:724d3e39ded8
- Parent:
- 8:b162bf17271f
dd
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| darzento | 1:cd96d1c79a8b | 1 | #include "mbed.h" |
| darzento | 1:cd96d1c79a8b | 2 | |
| darzento | 5:2ead41027963 | 3 | /***************************************************************************** |
| darzento | 6:276d384f8483 | 4 | ****************************************************************************** |
| darzento | 6:276d384f8483 | 5 | ****************************************************************************** |
| darzento | 6:276d384f8483 | 6 | ****************************************************************************** |
| darzento | 5:2ead41027963 | 7 | ******************************************************************************/ |
| darzento | 5:2ead41027963 | 8 | |
| darzento | 1:cd96d1c79a8b | 9 | DigitalOut myled(LED1); |
| darzento | 5:2ead41027963 | 10 | DigitalOut frame(); //Clock frame |
| darzento | 5:2ead41027963 | 11 | DigitalOut dot_Point(); //Time point |
| darzento | 5:2ead41027963 | 12 | BusOut hour(); //Hour hand |
| darzento | 5:2ead41027963 | 13 | BusOut minute(); //Minute hand |
| darzento | 9:724d3e39ded8 | 14 | BusOut |
| darzento | 5:2ead41027963 | 15 | InterruptIn hall(); //Hall sensor sensing interrupt |
| darzento | 7:11a20cba4eae | 16 | Timer timer; |
| darzento | 1:cd96d1c79a8b | 17 | |
| darzento | 6:276d384f8483 | 18 | void hour_hand(void); |
| darzento | 6:276d384f8483 | 19 | void minute_hand(void); |
| darzento | 7:11a20cba4eae | 20 | void sensor(); |
| darzento | 6:276d384f8483 | 21 | |
| darzento | 7:11a20cba4eae | 22 | int i=0; |
| darzento | 3:26633efdb309 | 23 | |
| darzento | 3:26633efdb309 | 24 | int main() |
| darzento | 3:26633efdb309 | 25 | { |
| darzento | 6:276d384f8483 | 26 | hall.rise(&sensor); //rising edge operating |
| darzento | 9:724d3e39ded8 | 27 | int a = 0; |
| darzento | 4:a1cb6536f303 | 28 | |
| darzento | 3:26633efdb309 | 29 | while(1) |
| darzento | 4:a1cb6536f303 | 30 | { |
| darzento | 6:276d384f8483 | 31 | frame = 1; |
| darzento | 6:276d384f8483 | 32 | hour_hand(); |
| darzento | 6:276d384f8483 | 33 | minute_hand(); |
| darzento | 7:11a20cba4eae | 34 | if (i==10) |
| darzento | 7:11a20cba4eae | 35 | { |
| darzento | 7:11a20cba4eae | 36 | timer.start(); |
| darzento | 7:11a20cba4eae | 37 | } |
| darzento | 7:11a20cba4eae | 38 | if (i==11) |
| darzento | 7:11a20cba4eae | 39 | { |
| darzento | 7:11a20cba4eae | 40 | timer.stop(); |
| darzento | 7:11a20cba4eae | 41 | |
| darzento | 9:724d3e39ded8 | 42 | a = timer.read(); |
| darzento | 7:11a20cba4eae | 43 | } |
| darzento | 1:cd96d1c79a8b | 44 | } |
| darzento | 6:276d384f8483 | 45 | } |
| darzento | 7:11a20cba4eae | 46 | void sensor() |
| darzento | 7:11a20cba4eae | 47 | { |
| darzento | 7:11a20cba4eae | 48 | i=i+1; |
| darzento | 7:11a20cba4eae | 49 | } |
| darzento | 6:276d384f8483 | 50 | |
| darzento | 6:276d384f8483 | 51 | void hour_hand(void) |
| darzento | 6:276d384f8483 | 52 | { |
| darzento | 6:276d384f8483 | 53 | hour = 0x1F; |
| darzento | 6:276d384f8483 | 54 | wait (); |
| darzento | 6:276d384f8483 | 55 | hour = 0x00; |
| darzento | 6:276d384f8483 | 56 | wait (); |
| darzento | 6:276d384f8483 | 57 | } |
| darzento | 6:276d384f8483 | 58 | void minute_hand(void) |
| darzento | 6:276d384f8483 | 59 | { |
| darzento | 6:276d384f8483 | 60 | minute = 0x0FF; |
| darzento | 6:276d384f8483 | 61 | wait (); |
| darzento | 6:276d384f8483 | 62 | minute = 0x00; |
| darzento | 6:276d384f8483 | 63 | wait(); |
| darzento | 5:2ead41027963 | 64 | } |
