Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Manvi Mittal
- * Increasing Intensity
- */
- const int pinLed = 6;
- const int pinButton = 2;
- int readValue = 0;
- boolean lightOn = 0;
- void setup()
- {
- // put your setup code here, to run once:
- pinMode (pinButton, INPUT);
- pinMode (pinLed, OUTPUT);
- Serial.begin (9600);
- digitalWrite (pinLed, HIGH);
- delay (50);
- digitalWrite (pinLed, LOW);
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
- readValue = digitalRead (pinButton);
- if (readValue == 1)
- {
- for (int i = 0; i <= 200; i++)
- {
- analogWrite (pinLed, i);
- delay (50);
- }
- }
- else
- {
- digitalWrite (pinLed, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment