Revision 651
trying to fix red
orb.c | ||
---|---|---|
52 | 52 |
{ |
53 | 53 |
/*data direction registers, blue, green (bit 6) and red (bit 4)*/ |
54 | 54 |
//DDRB = _BV(DDB4); |
55 |
DDRB = 0b00010000; |
|
55 |
DDRB |= 0b00010000;
|
|
56 | 56 |
|
57 | 57 |
//DDRD = _BV(DDD4)|_BV(DDD6); |
58 |
DDRD = 0b01010000; |
|
58 |
DDRD |= 0b01010000;
|
|
59 | 59 |
|
60 | 60 |
|
61 | 61 |
/*blue is here. it goes on timer 0*/ |
62 | 62 |
/*timer counter control registers for timer 0*/ |
63 | 63 |
//TCCR0A = _BV(COM0B1)|_BV(COM0B0)|_BV(WGM01)|_BV(WGM00); |
64 |
TCCR0A = 0b00110011; |
|
64 |
TCCR0A |= 0b00110011;
|
|
65 | 65 |
|
66 | 66 |
//TCCR0B = _BV(CS00); |
67 |
TCCR0B = 0b00000001; |
|
67 |
TCCR0B |= 0b00000001;
|
|
68 | 68 |
OCR0B = 0; |
69 | 69 |
|
70 | 70 |
/*green is here. it goes on timer 2*/ |
71 | 71 |
//TCCR2A = _BV(COM2B1)|_BV(COM2B0)|_BV(WGM21)|_BV(WGM20); |
72 |
TCCR2A = 0b00110011; |
|
72 |
TCCR2A |= 0b00110011;
|
|
73 | 73 |
|
74 | 74 |
//TCCR2B = _BV(CS20); |
75 |
TCCR2B = 0b00000001; |
|
75 |
TCCR2B |= 0b00000001;
|
|
76 | 76 |
OCR2B = 0; |
77 | 77 |
|
78 | 78 |
|
79 | 79 |
/*red is here. it goes on timer 1 which counts to the value in ICR1 instead of 8 bits*/ |
80 | 80 |
//TCCR1A = _BV(COM1B1)|_BV(COM1B0)|_BV(WGM11); |
81 |
TCCR1A = 0b00110001; |
|
81 |
TCCR1A |= 0b00110001;
|
|
82 | 82 |
|
83 | 83 |
//TCCR1B = _BV(WGM13)|_BV(WGM12)|_BV(CS10); |
84 |
TCCR1B = 0b00011001; |
|
84 |
TCCR1B |= 0b00011001;
|
|
85 | 85 |
ICR1 = 0x9C40; |
86 | 86 |
OCR1B = 0; |
87 | 87 |
|
... | ... | |
114 | 114 |
red *= 0x9C40; |
115 | 115 |
red = (int)(red/256); |
116 | 116 |
OCR1B = red; |
117 |
|
|
117 | 118 |
|
118 | 119 |
return 0; |
119 | 120 |
} |
Also available in: Unified diff