I recently created a mod chip from an open source project, and they were toggling 2 LED's with the current flowing towards the GPIO.
It seemed to work with no issues, so I decided to do the same thing in one of my own projects.
I figured I may as well start with programming the LED before I tackle the USB functionality, but quickly realized I have no idea how to do that.
So I opened up the source code for the mod chip, and they have the LED configured as an output, which is now confusing me more than ever.
Surely the magic smoke would appear if I ran current towards an output, right?
It could be possible the source code I have, is for a different version, but I'll let you guys be the judge of that.
Anyways, my main question is, how can I toggle an LED, where the anode is connected to VCC, and the cathode to GPIO.
Here is the LED code for the modchip, it is literally just toggling the output pin, but it just seems strange to run current towards an output.
// green #define LED1_ON PORTD &=~0x04 #define LED1_OFF PORTD |= 0x04 // red #define LED2_ON PORTD &=~0x08 #define LED2_OFF PORTD |= 0x08 #define LED_INIT DDRD = 0x0C;
Here is my circuit, the pin on the modchip is connected virtually the same way, just minus E13.