Week 2 – Blink

Hi everyone, this is a step by step into my first homework, I started controlling the LED with the potentiometer ..

photo 1

connecting Arduino with the board

photo 2

adding the potentiometer to control an LED

photo 3

adding the LED


const int ledPin = 9; // pin that the LED is attached to
int analogValue = 0; // value read from the pot
int brightness = 0; // PWM pin that the LED is on.

void setup() {
// led pin as an output:
pinMode(ledPin, OUTPUT);

void loop() {
analogValue = analogRead(A0);
brightness = analogValue /4;  //divide by 4 to fit in a byte
analogWrite(ledPin, brightness);
Serial.println(brightness); // print the brightness value back to the serial monitor


Then after this exercise I wanted to use a Flex sensor to manipulate the brightness:

photo 4

then I had a problem with resistors. I think. I hope.




Leave a Reply

Your email address will not be published.