SHARE
TWEET

twocolor

inventrkits Jan 22nd, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Arduino test code for KY011
  2. int redpin = 11; // select the pin for the red LED
  3. int greenpin = 10; // select the pin for the green LED
  4. int val;
  5. void setup () {
  6.    pinMode (redpin, OUTPUT);
  7.    pinMode (greenpin, OUTPUT);
  8. }
  9. void loop () {
  10.    for (val = 255; val> 0; val--)
  11.       {
  12.       analogWrite (greenpin, val);
  13.       analogWrite (redpin, 255-val);
  14.       delay (15);
  15.    }
  16.    for (val = 0; val <255; val++)
  17.       {
  18.       analogWrite (greenpin, val);
  19.       analogWrite (redpin, 255-val);
  20.       delay (15);
  21.    }  
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top