Advertisement
Guest User

Untitled

a guest
Jul 7th, 2019
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. byte led_pwm_array[16];
  2. byte no_of_leds = 16;
  3. byte resolution = 120;
  4. byte overlap = resolution/2;
  5.  
  6. for (byte i = 0; i < no_of_leds; i++){
  7.   led_pwm_array[i] = abs(abs(map(constrain(a0,(i*overlap),((i*overlap)+resolution)),(i*overlap),((i*overlap)+resolution), -255, 255))-255);
  8.   }
  9.  
  10.  
  11. Serial.print(a0);
  12. for (byte i = 0; i < no_of_leds; i++){
  13.     Serial.print(" ");Serial.print(led_pwm_array[i]);
  14. }
  15. Serial.println(" ");
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement