1
Angles ang = {0.0,46.0,91.2,134.7,179.2}, the unit is deg (steps). I have to implement code that initializes the values as a global array, and then defines the void somaCum(float arr[]){} function that computes the cumulative sums(Scum={S1,S2,S3,...,Sn}={X1,X1+X2,X1+X2+X3,...,X1+X2+...+ Xn} ) of each element, and write the values to the console . Present an example of usage (invoke function plus result in console).
float acc[]={0.0,46.0,91.2,134.7,179.2}
int accSize = 5;
void setup(){
Serial.begin(9600);
somaCum(acc);
}
void loop(){}
void somaCum(float acc[]){
for(int n=0;n<accSize;n++){
//Como é que faço a função?
}
Do you want to print the result of all the sums, or just the final sum? If it is the result of all sums, you just want to view the sums or you also want to store them in an array?
– Geraldão de Rívia
Result of all sums. Only visualize the sums. The statement of the question is this same.
– Yunrin 127