//Define ints int pulse1 = 8; int pulse2 = 7; int pulse3 = 6; int val1; int val2; int val3; int ledval1; int ledval2; int ledval3; int red = 11; int green = 10; int blue = 9; void setup() { pinMode(pulse1, INPUT); //Define pulsepin1 as input pinMode(red, OUTPUT); //Define red as Output pinMode(pulse2, INPUT); //Define pulsepin2 as input pinMode(green, OUTPUT); //Define green as Output pinMode(pulse3, INPUT); //Define pulsepin3 as input pinMode(blue, OUTPUT); //Define blue as Output } void loop() { val1 = pulseIn(pulse1, HIGH); //Read pulse1 and store it as val1 constrain(val1, 740, 1830); //Constrain val1 to make sure ve only get numbers ranging from 740 to 1830 ledval1 = map(val1, 740, 1830, 0, 254); //Map val1 to PWM analogWrite(red, ledval1); //Write the PWM value to red val2 = pulseIn(pulse2, HIGH); //Read pulse2 and store it as val2 constrain(val2, 740, 1830); //Constrain val2 to make sure ve only get numbers ranging from 740 to 1830 ledval2 = map(val2, 740, 1830, 0, 254); //Map val2 to PWM analogWrite(green, ledval2); //Write the PWM value to green val3 = pulseIn(pulse3, HIGH); //Read pulse3 and store it as val3 constrain(val3, 740, 1830); //Constrain val3 to make sure ve only get numbers ranging from 740 to 1830 ledval3 = map(val3, 740, 1830, 0, 254); //Map val3 to PWM analogWrite(blue, ledval3); //Write the PWM value to blue }