c - How to assign a specific [x] value to port pin? -
how can assign dynamic value pin specific pin on avr chip. instance have:
void life_reset(void){ portc |= (1<<pc0); portc |= (1<<pc1); portc |= (1<<pc2); life_number = 2; } void lost_life(void){ life_number--; portc &= ~(1<<pc2); }
which decrements life_number
variable , bitwise and's left shift of pc2.
in case, each pc[x]
value connected led. how can write portc &=
statement pc[x]
value of life_number
.
pseudocode -what want do
void lost_life(void){ life_number--; portc &= ~(1<<pc[*life_number*]); }
just use life number, because pcn macros in fact same numbers show in name.
portc &= ~(1<<life_number);
Comments
Post a Comment