Advertisement
Guest User

Arduino-Dimmer

a guest
Nov 24th, 2014
195
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int ledPin = A0; // the pin that the LED is attached to,here I’m using A0
  2.  
  3. void setup() {
  4.  
  5. Serial.begin(9600);
  6.  
  7. pinMode(ledPin, OUTPUT);
  8.  
  9. }
  10.  
  11. void loop() {
  12.  
  13. byte brightness;
  14.  
  15. if (Serial.available()) {
  16.  
  17. brightness = Serial.read();
  18.  
  19. analogWrite(ledPin, brightness);
  20.  
  21. }
  22.  
  23. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement