#define led_pin 0 // ATtiny PA6 #define photo_pin 1 //ATtiny PA7 int sensor_value = 0; int output_value = 0; int output_value_ease = 0; void setup() { pinMode(led_pin, OUTPUT); pinMode(photo_pin, INPUT); }//void setup void loop() { // Read the analog value coming in from the phototransistor sensor_value = analogRead(photo_pin); //Map to 1 - 1000 and then ease that value output_value = map(sensor_value, 0, 1023, 1, 1000); output_value_ease = easeOut(output_value, 1.0, 1000.0); // Blink the LED with a 2*output_value_ease timing blinkLED(output_value_ease); }//void loop //t = current value, b = start value, d = end value int easeOut(int t, float b, float d) { float n = (t - b) / (d - b); return(int)(d - b) * (1.0 - n*n*n*n) + b; }// int easeOut // Make the LED blink with a delay of delay_time void blinkLED(int delay_time) { digitalWrite(led_pin, HIGH); delay(delay_time); digitalWrite(led_pin, LOW); delay(delay_time); }// void blink