ATtiny 85 Programmable Shield for Arduino Uno R3 Made by Jandre Snijman 16 June 2024
// Define the pin where the LED is connected
#define LED_PIN 0
void setup() {
// Set the LED pin as an output
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Turn the LED on (HIGH is the voltage level)
digitalWrite(LED_PIN, HIGH);
// Wait for a second
delay(1000);
// Turn the LED off by making the voltage LOW
digitalWrite(LED_PIN, LOW);
// Wait for a second
delay(1000);
}
Explanation:
- Define LED_PIN: We define the pin where the LED is connected, in this case, pin 0.
- Setup: In the
setup()
function, we set the LED pin as an output. - Loop: In the
loop()
function, we turn the LED on, wait for one second, turn it off, and wait for another second. This cycle repeats indefinitely.
Uploading Code to ATtiny85:
To upload the code to your ATtiny85, follow these steps:
Install ATtiny Board Package:
- Open the Arduino IDE.
- Go to
File
>Preferences
. - In the
Additional Boards Manager URLs
field, add this URL:https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
. - Click
OK
.
Select ATtiny85 Board:
- Go to
Tools
>Board
>Boards Manager
. - Search for "attiny" and install the
attiny by David A. Mellis
package. - Select
ATtiny25/45/85
from theTools
>Board
menu. - Choose
ATtiny85
underTools
>Processor
. - Select
8 MHz (internal)
underTools
>Clock
.
- Go to
Programmer:
- Select
Arduino as ISP
underTools
>Programmer
.
- Select
Upload the Code:
- Connect your ATtiny85 to your computer via an ISP programmer or an Arduino used as ISP.
- Go to
Tools
>Burn Bootloader
to set the fuses. - Upload the code by clicking on the
Upload
button.
This setup should get your LED blinking on pin 0 of your ATtiny85.