> For the complete documentation index, see [llms.txt](https://docs.idew.org/code-internet-of-things/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.idew.org/code-internet-of-things/tutorials/create-smart-light/3.2-modify-hello-world.md).

# C-2 Copy Hello World App

Next, you'll use the "Hello World" app as starter code for your "Smart Light" device app. You'll use this code to verify that you connected the LED correctly.

## Log In to Particle Build

One person on your team should log in to [Particle Build](https://build.particle.io/) using your team's Particle account login.

Once you're logged in, you should see a new app template in the code editor.  (If not, just click the "Create New App" button in the Code menu panel.)

## Title New App

Enter `smart-light` as your app's title.

## Copy Hello World Code

You'll use the `hello-world` app as starter code for your `smart-light` app:

{% code title="" %}

```cpp
/*
Hello World Test
Team Info
Teacher - Class Period
*/

int LED = D7;

void setup() {
    pinMode(LED, OUTPUT);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(1000);
    digitalWrite(LED, LOW);
    delay(1000);
}

```

{% endcode %}

{% hint style="success" %}
**COPY CODE:** When using this IoT code guidebook, you can copy a code block simply by clicking the **copy icon** displayed in the upper right of the code block.
{% endhint %}

1. Copy the "Hello World" code above.
2. In the code editor panel, select all the existing code in the `smart-light` app, and then replace it by pasting in the copied code.

Save your `smart-light` app code by clicking the **Save** icon in the left navigation bar.

<div align="left"><img src="/files/-LJ0pSQvLOewPan-6Z_m" alt="Save Icon"></div>

## Modify App Code

You'll need to make a few changes to the app code:

1. Modify the comment block:  Change `Hello World` to `Smart Light Device`, and be sure your team info, teacher's name, and class period are correctly listed.
2. Modify line 7 that declares the `LED` variable:  Change the variable's value from `D7` to `D0` (or whichever pin number your LED is connected to). This will allow your app to control your LED.

## Flash App to Device

Be sure your Photon device is connected to Wi-Fi and Particle Cloud.

Flash your app code to your Photon device by clicking the **Flash** icon in the left navigation bar. (Particle Build will first save and verify your code before flashing it to your device.)

<div align="left"><img src="/files/-LJEjiwZZ_lGiFWTeLmW" alt="Flash Icon"></div>

Once your Photon has downloaded the new app and restarted, the updated app will start running:

* Confirm that the LED light that you connected to your Photon circuit board blinks on and off in a repeating pattern (with the light turning on for 1 second and then turning off for 1 second).  The blue D7 light should be turned off.

## Troubleshooting Issues

If the LED light that you connected is **not** blinking, then there is a mistake in your app code – or a mistake in your wiring connection – or a mistake in both.

If the blue D7 light is blinking, then check your app code to verify whether you changed the pin number assigned to the `LED` variable. If necessary, revise your code, and flash the updated app to your device.

Otherwise, verify that the LED light's positive leg (the bent leg) is connected (via a jumper wire) to the same I/O pin number that is assigned to the `LED` variable in your app code. If necessary, change either your wiring or your code, so the pin numbers match. If you revised your code, flash the updated app to your device.

If that still doesn't solve the issue, then double-check all your wiring by referring back to the connection instructions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.idew.org/code-internet-of-things/tutorials/create-smart-light/3.2-modify-hello-world.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
