> ## Content Index
> Fetch the complete content index at: https://badllama.net/llms.txt
> Use this file to discover other available public pages before exploring further.

# A light reader, LED lighter
- URL: https://badllama.net/a-light-reader-led-lighter/
- Published: 2020-06-25T10:52:33.000Z
- Updated: 2020-07-01T14:48:19.000Z
- Author: Oli Howson
- Tags: #Import 2026-10-24 07:51

This is a walkthrough for an [IoT Workshop](https://seras.org.uk/2020/06/26/environment-maker-challenge-day-4-with-oli-howson/?ref=badllama.net) I produced for SERAS.

Recording of the workshop:

- [Walkthrough as a PowerPoint](https://www.dropbox.com/s/9kbc51vxvipwuwq/Session%201%20-%20Walkthrough.pptx?dl=0&ref=badllama.net)
- [Walkthrough as a PDF](https://www.dropbox.com/s/gldjc3qyarpkjvl/Session%201%20-%20Walkthrough.pdf?dl=0&ref=badllama.net)

Or Walkthrough as a video on YouTube.

```
int photoCellPin = 0;
int photoCellReading;
int LEDPin = 3;
int LEDBrightness;

void setup()
{
  Serial.begin(9600);
  pinMode(LEDPin, OUTPUT);
  pinMode(photoCellPin,INPUT);
}

void loop()
{
  photoCellReading = analogRead(photoCellPin);
  Serial.print("Analog reading = ");
  Serial.println(photoCellReading);
  photoCellReading = 1023 - photoCellReading;
  LEDBrightness = map(photoCellReading, 0, 1023, 0, 255);
  Serial.print("LED output = ");
  Serial.println(LEDBrightness);
  analogWrite(LEDPin, LEDBrightness);
  delay(100);
}

```