Hi
i am trying to make a code for Ardinu that use the map function with PWM and the values comes from sensor
i mean the valuse that comes from the sensors will first enter to the map function which will convert the
range that take from the sensor to the range of the pwm and after that controlling the lighting of the led by pwm
could you help me
i have already codes for using PWM with LED but i want to connect the Ardinu with sensor beside of the led and map the values from the sensor
i tried to explain .if something is not clear ask me please
here is example
int green = 11; // Digital pin 11 - Green LED
int blue = 9; // Digital pin 9 - Blue LED
int time = 5; // define delay element
int pulsewidth; // define pulsewidth (0-255)
void setup() {
//
}
void loop() {
// slowly fade the LEDs to full brightness
for (pulsewidth=0; pulsewidth = 0; pulsewidth--){
analogWrite(green, pulsewidth);
analogWrite(red, pulsewidth);
analogWrite(blue, pulsewidth);
delay(time);
}
}