int wwhite = 0;
int cwhite = 1;
int ain = A1;
void setup()
{
pinMode(cwhite, OUTPUT);
pinMode(wwhite, OUTPUT);
pinMode(ain, INPUT);
}
void loop()
{
int val = analogRead(ain);
val = map(val, 0, 1023, 0, 255);
analogWrite(wwhite, val);
analogWrite(cwhite, 255-val);
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.