Skip to content
The Chat Archive
gpt-3.5-turbo-0301· OpenAI WildChat-4.8M (AI2)

Can you write a hello world program that would run on an arduino

  1. User

    Can you write a hello world program that would run on an arduino

  2. Assistant

    Sure, here's a simple hello world program for an Arduino board:

    void setup() {
      // initialize the digital pin 13 as an output.
      pinMode(13, OUTPUT);
    }
    
    void loop() {
      // turn the LED on (HIGH is the voltage level)
      digitalWrite(13, HIGH);
      delay(500); // wait for a half second
      // turn the LED off by making the voltage LOW
      digitalWrite(13, LOW);
      delay(500); // wait for a half second
    }
    

    This program will blink the built-in LED on the Arduino board on and off every half second. When you upload this sketch onto an Arduino board and power it on, you should see the LED blinking. This is a minimal example of a program that runs on an Arduino board, but it demonstrates the basics of how to use the digital outputs of the board.