Mechatronics LAB
Published © Apache-2.0

Arduino Workshop-Pulsating Lamp

Today I show you how to control your led brightness its very easy work I show you step by step and it also calls Pulsating Lamp

BeginnerProtip1 hour2,542
Arduino Workshop-Pulsating Lamp

Things used in this project

Story

Read more

Schematics

Arduino Workshop-Pulsating Lamp

Code

Code snippet #1

Arduino
int ledPin = 11;
float sinVal;
int ledVal;

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

void loop() {
  for (int x = 0; x < 180; x++) {
    // Convert degrees to radians then obtain sin value
    sinVal = (sin(x * (3.1412 / 180)));
    ledVal = int(sinVal * 255);
    analogWrite(ledPin, ledVal);
    delay(25);
  }
}

Credits

Mechatronics LAB
75 projects • 49 followers
I am Sarful , I am a Mechatronics Engineer & also a teacher I am Interested in the evolution of technology in the automation industry .

Comments