Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Fading
- This example shows how to fade an LED using the analogWrite() function.
- The circuit:
- * LED attached from digital pin 9 to ground.
- Created 1 Nov 2008
- By David A. Mellis
- modified 30 Aug 2011
- By Tom Igoe
- http://arduino.cc/en/Tutorial/Fading
- This example code is in the public domain.
- */
- int ledPin = 2; // LED connected to digital pin 9
- void setup() {
- // nothing happens in setup
- }
- void loop() {
- // fade in from min to max in increments of 5 points:
- // ต้องใส่ 255 ก่อนการเรียกใช้งาน
- analogWrite(ledPin, 255);
- analogWrite(ledPin, 32); delay(200);
- analogWrite(ledPin, 128); delay(200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement