Most of the boards

Source: https://www.arduino.cc/en/tutorial/blink

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

For digispark ATtiny85

void setup()
{
  //Set Pins 0 and 1 as outputs.
  //Some Digisparks have a built-in LED on pin 0, while some have it on
  //pin 1. This way, we can all Digisparks.
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
}
void loop()
{
  //Set the LED pins to HIGH. This gives power to the LED and turns it on
  digitalWrite(0, HIGH);
  digitalWrite(1, HIGH);
  //Wait for a second
  delay(1000);
  //Set the LED pins to LOW. This turns it off
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  //Wait for a second
  delay(1000);
}
  • No labels