# Lighthouse Basic Signal

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LpfAbaM-FNM4QhSvAX3%2F-LpfAuhwQC48pMIg6EEX%2Ftumblr_ozl9w4JjFE1wi6nmxo1_500.gif?alt=media\&token=f5de2fee-884a-4c27-828e-ecf9895dbec1)

### Basic Functionality: If it is dark outside the  signal should stay on for 3 seconds and off for 1 seconds. If it is daylight outside, the signal should remain off.

To develop the algorithm: use the LED Grid to send your signal. However in the next  steps you will add an extended LED bulb

```
Repeat Forever
    if  light level is low
        turn on light signal
    else
        turn off light signal      
    
```

**TIP**: Signal will all the LED on full bright for ease - since we are going to change your signal from the LED Grid to an attached LED Bulb, there is no need to develop a complicated signal here.

Now that you are sending a signal based the "time" of day, it is time to modify the  signal to flash during the night for incoming ships to see.

> “If you close your eyes, no lighthouse can help you!” ― Mehmet Murat ildan

We want the signal to stay on for 3 seconds and turn off for 1 second, so you need to  modify the code when the light level is low.

```
if light level is low
    turn on light signal
    pause 3 seconds
    turn off light signal
    pause 1 second
```

**TIP:** the microbit doesn't measure time in seconds, it measures time in milliseconds

## Our code doesn't turn the light back on? So does the light only flash one time per night? Is there an error in our algorithm?

Your lighthouse should have its own unique signal, this helps navigating ships identify the lighthouse in the distance. Take a minute and design your own simple, yet unique flashing signal.

This algorithim and portions of this assignment taken directly from [https://sites.google.com/view/microbitofthings/2-simple-control-systems/6-lighthouse?authuser=0](https://sites.google.com/view/microbitofthings/2-simple-control-systems/6-lighthouse?authuser=0)
