pin D4 ---> +anode led ---> -cathode led ---> 1k resistor ---> GND
My code looks like this:
Code: Select all
void led_layer_set(uint32_t state) {
DDRD |= (1<<4);
if ((1<<1 & state) != 0) {
print("layer pressed");
PORTD |= (1<<4);
} else {
print("released");
PORTD &= ~(1<<4);
}
}
I've used HID Listen and print statements to verify that the code triggers properly when I press and release, but the light doesn't come on. I have to believe I don't understand how it should be wired and how pins are activated.