-
Notifications
You must be signed in to change notification settings - Fork 0
/
sistem.cpp
53 lines (47 loc) · 1.13 KB
/
sistem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "sistem.h"
#include "arduino.h"
extern bool flag;
bool estado = 0;
void initPorts(void)
{
pinMode(ROJO, OUTPUT);
pinMode(AMARILLO, OUTPUT);
pinMode(VERDE, OUTPUT);
pinMode(AZUL, OUTPUT);
pinMode(P1, INPUT);
pinMode(P2, INPUT);
pinMode(SEGA, OUTPUT);
pinMode(SEGB, OUTPUT);
pinMode(SEGC, OUTPUT);
pinMode(SEGD, OUTPUT);
pinMode(SEGE, OUTPUT);
pinMode(SEGF, OUTPUT);
pinMode(SEGG, OUTPUT);
pinMode(SEGSP, OUTPUT);
pinMode(T1, OUTPUT);
pinMode(T2, OUTPUT);
pinMode(T3, OUTPUT);
Serial.begin(9600);
}
//*******************
//Configura Timer2 **
//*******************
void initTimer2(void)
{
SREG = 0b01111111; //Desabilitar interrupciones
TIMSK2 = 0b00000001; //Habilita la interrupcion por desbordamiento
TCCR2B = 0b00000011; //Configura preescala para que FT2 sea de 250KHz
SREG = 0b10000000; //Habilitar interrupciones //Desabilitar interrupciones
TCNT2 = 5; //255-5 =250 (el valor que queremos)
}
//**************
//Led Testigo **
//**************
void animacionLedTestigo() {
if (flag)
{
flag = 0;
estado = !estado;
digitalWrite(AZUL, estado);
}
}