This website uses cookies to ensure you get the best experience on our website.
ATtiny 85 LED blink pin 0

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:

  1. Define LED_PIN: We define the pin where the LED is connected, in this case, pin 0.
  2. Setup: In the setup() function, we set the LED pin as an output.
  3. 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:

  1. 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.
  2. 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 the Tools > Board menu.
    • Choose ATtiny85 under Tools > Processor.
    • Select 8 MHz (internal) under Tools > Clock.
  3. Programmer:

    • Select Arduino as ISP under Tools > Programmer.
  4. 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.

Emoji Reactions
What do you think?
👍 0
😆 0
😍 0
😲 0
😡 0
😢 0

Leave a Reply

Your email address will not be published. Required fields are marked *


Math Captcha
− 4 = 4