Skip to content

Instantly share code, notes, and snippets.

@bradford-hamilton
Last active April 24, 2023 19:48
Show Gist options
  • Save bradford-hamilton/c9cea8975f2fbf7ffd7826461dd56048 to your computer and use it in GitHub Desktop.
Save bradford-hamilton/c9cea8975f2fbf7ffd7826461dd56048 to your computer and use it in GitHub Desktop.
ATtiny85 - Initial LED on example for post
// Port B data direction register 0x17 (+ 0x20 for the special func register offset)
#define DDRB *((volatile unsigned char*)0x37)
// Port B data register 0x18 (+ 0x20 for the special func register offset)
#define PORTB *((volatile unsigned char*)0x38)
int main()
{
// Set data direction for Port B bit 0 (PB0 - pin 5)
DDRB |= (1 << 0);
// Set data for Port B bit 0 (PB0 - pin 5) to 1
PORTB |= (1 << 0);
while (1) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment