acrylic art project started, and projects moved to individual folders
This commit is contained in:
		
							
								
								
									
										21
									
								
								acrylic-art-code/acrylic-art-code.ino
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								acrylic-art-code/acrylic-art-code.ino
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
int light = 0;
 | 
			
		||||
void setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  int ss = 30; // sample size for light sensor
 | 
			
		||||
  int average = 0;
 | 
			
		||||
  for (int x = 0; x < ss; x++) {
 | 
			
		||||
    average += analogRead(light);
 | 
			
		||||
    delay(1);
 | 
			
		||||
  }
 | 
			
		||||
  average /= ss;
 | 
			
		||||
  String bitIn = "";
 | 
			
		||||
  for(int x = 0; x <9; x++) {
 | 
			
		||||
      bitIn += average >> x;
 | 
			
		||||
  }
 | 
			
		||||
  int a = bitIn.substring(0, 3).toInt();
 | 
			
		||||
  int b = bitIn.substring(3, 6).toInt();
 | 
			
		||||
  int c = bitIn.substring(6, 9).toInt();
 | 
			
		||||
  // set LED strips to c, b, a (in order RGB)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user