23 lines
532 B
C
23 lines
532 B
C
#include "main.h"
|
|
|
|
int power(int tab){
|
|
int freq = 250; //imposé par le capteur Vegetal Signal
|
|
float periode = 1 / freq;
|
|
int power[8] = {0,0,0,0,0,0,0,0};
|
|
for(int i = 0; i < 8; i++){
|
|
int j = 0;
|
|
int res = 0;
|
|
while(1){
|
|
if(tab[j+1][i]==NULL) break;
|
|
float aire = ( pow(tab[j][i],2) + pow(tab[j+1][i],2) ) / 2 * periode;
|
|
res += aire;
|
|
j++;
|
|
}
|
|
power[i] = res;
|
|
}
|
|
return power;
|
|
}
|
|
|
|
int main(int argc , char** argv){
|
|
power();
|
|
} |