Сделал подсветку используя переходник HDMI на VGA
Сигналы RGB преобразую в постоянные уровни и подаю на аналоговые входы ардуино
За схемы от руки простите
Все работает но как использовать сигналы V и H (вертикальной и горизонтальной синхронизации)чтобы была динамика
пока не как сообразить не могу
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	


								Сигналы RGB преобразую в постоянные уровни и подаю на аналоговые входы ардуино
За схемы от руки простите
Все работает но как использовать сигналы V и H (вертикальной и горизонтальной синхронизации)чтобы была динамика
пока не как сообразить не могу
			
				Код:
			
		
		
		#include <Adafruit_NeoPixel.h>
int red,green,blue = 0;
//  IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIN 6
#define NUMPIXELS 79
#define VGA_R_PIN A0
#define VGA_G_PIN A1
#define VGA_B_PIN A2
// Initialize the neopixel strip
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
 void setup() {
    // Set the pins connected to the potentiometer as inputs
    pinMode(0,INPUT);
    pinMode(1,INPUT);
    pinMode(2,INPUT);
    
    
 strip.begin();
 strip.show(); //  Initialize all pixels to 'off'
 rainbowCycle( 1 ); // Flash rainbows at the begining
}
void loop() {
    // Read and store the potentiometer values
    // We are scaling them from a 12bit scale to an 8 bit scale
 red = map(analogRead(A0), 0, 820, 0 , 255);
 green = map(analogRead(A1), 0, 820, 0 , 255);
 blue = map(analogRead(A2), 0 , 820, 0 , 255);
 
    // set colors of all the eight neopixles
    for(int pixel = 0 ;pixel <   NUMPIXELS   ;pixel++)
    {
 strip.setPixelColor(pixel, red, green, blue);
    }
 strip.show(); // Update the strip with new color values
    delay(50);
}
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;
  for(j=0 ; j<256 * 5 ; j++) { //  5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
 strip.setPixelColor(i, Wheel(((i * 256  / strip.numPixels()) + j) & 255));
    }
 strip.show();
    delay(wait);
  }
}
//  Helper function for rainbows
//  Input a value 0 to 255 to get a color value.
//  The colours are a transition r - g - b - back to r.
 uint32_t Wheel(byte WheelPos) {
 WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
 WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
 WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Вложения
- 
		
			
	
			
		
		
		82.4 KB Просмотры: 37
- 
		
			
	
			
		
		
		97.5 KB Просмотры: 32
- 
		
			
	
			
		
		
		95.2 KB Просмотры: 35
- 
		
			
	
			
		
		
		12.8 KB Просмотры: 33
 
				
		 
				 
				 
				 
				 
 
		 
 
		
 
				 
				 
				
