Algoritmo de un cronometro de conteo de horas, segundos decenas de milisegundos, a partir del miltiplexado de 6 display de 7 segmentos.
Fork of Ticker_HelloWorld by
main.cpp@2:87f26931d8d1, 2015-03-27 (annotated)
- Committer:
- mbedAustin
- Date:
- Fri Mar 27 20:17:43 2015 +0000
- Revision:
- 2:87f26931d8d1
- Parent:
- 0:5014bf742e9b
- Child:
- 4:a60b811bfe1e
Added license to main.c file.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 2:87f26931d8d1 | 1 | /* mbed Example Program |
mbedAustin | 2:87f26931d8d1 | 2 | * Copyright (c) 2006-2014 ARM Limited |
mbedAustin | 2:87f26931d8d1 | 3 | * |
mbedAustin | 2:87f26931d8d1 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbedAustin | 2:87f26931d8d1 | 5 | * you may not use this file except in compliance with the License. |
mbedAustin | 2:87f26931d8d1 | 6 | * You may obtain a copy of the License at |
mbedAustin | 2:87f26931d8d1 | 7 | * |
mbedAustin | 2:87f26931d8d1 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbedAustin | 2:87f26931d8d1 | 9 | * |
mbedAustin | 2:87f26931d8d1 | 10 | * Unless required by applicable law or agreed to in writing, software |
mbedAustin | 2:87f26931d8d1 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbedAustin | 2:87f26931d8d1 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbedAustin | 2:87f26931d8d1 | 13 | * See the License for the specific language governing permissions and |
mbedAustin | 2:87f26931d8d1 | 14 | * limitations under the License. |
mbedAustin | 2:87f26931d8d1 | 15 | */ |
mbed_official | 0:5014bf742e9b | 16 | #include "mbed.h" |
mbed_official | 0:5014bf742e9b | 17 | |
mbed_official | 0:5014bf742e9b | 18 | Ticker flipper; |
mbed_official | 0:5014bf742e9b | 19 | DigitalOut led1(LED1); |
mbed_official | 0:5014bf742e9b | 20 | DigitalOut led2(LED2); |
mbed_official | 0:5014bf742e9b | 21 | |
mbed_official | 0:5014bf742e9b | 22 | void flip() { |
mbed_official | 0:5014bf742e9b | 23 | led2 = !led2; |
mbed_official | 0:5014bf742e9b | 24 | } |
mbed_official | 0:5014bf742e9b | 25 | |
mbed_official | 0:5014bf742e9b | 26 | int main() { |
mbed_official | 0:5014bf742e9b | 27 | led2 = 1; |
mbed_official | 0:5014bf742e9b | 28 | flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds) |
mbed_official | 0:5014bf742e9b | 29 | |
mbed_official | 0:5014bf742e9b | 30 | // spin in a main loop. flipper will interrupt it to call flip |
mbed_official | 0:5014bf742e9b | 31 | while(1) { |
mbed_official | 0:5014bf742e9b | 32 | led1 = !led1; |
mbed_official | 0:5014bf742e9b | 33 | wait(0.2); |
mbed_official | 0:5014bf742e9b | 34 | } |
mbed_official | 0:5014bf742e9b | 35 | } |