/* * i2c_test_attiny85.c * * Created: 12/11/2021 15:26:38 * Author : 40008304 */ #if __GNUC__ #include #include #else #include #include #endif #include "led_gen.h" #include "led_receptor.h" #include "usiTwiSlave.h" #define NOM_CONSTRUC 0x08 #define NOM_CAPTEUR 0x10 #define VALEUR_DEMAN 0x49 #define BASIC_MODE 0x42 unsigned char adcled1; unsigned char adcled2; double moyLed1=0; double moyLed2=0; int iMoy=0; volatile unsigned char recVal1=0; volatile unsigned char recVal2=0; volatile unsigned char recVal=0; ISR (ADC_vect){ adcled1=measureLed1(); adcled2=measureLed2(); moyLed1=moyLed1 + adcled1; moyLed2=moyLed2 + adcled2; iMoy++; if(iMoy >= 2000) { moyLed1=moyLed1/iMoy; moyLed2=moyLed2/iMoy; recVal1=(int)moyLed1; recVal2=(int)moyLed2; recVal=compareLed(recVal1,recVal2); moyLed1=0; moyLed2=0; iMoy=0; } ADCSRA |= (1<