i'm having problems with my S() function. it takes values from the array segment[] but it doesn't want to take values from theta[].
int theta[3];
int Stheta[5];
int segment[3];int j;
void setup()
{int h=2;
int m=15;
int s=0;Serial.begin(9600);
theta[0] = 30h;
theta[1] = 6m;
theta[2] = 6*s;
Serial.println(theta[0]);
Serial.println(theta[1]);
Serial.println(theta[2]);segment[0] = fsegment(theta, j=0);
segment[1] = fsegment(theta, j=1);
segment[2] = fsegment(theta, j=2);Serial.println(segment[0]);
Serial.println(segment[1]);
Serial.println(segment[2]);S(theta, segment, Stheta);
Serial.println(Stheta[0]);
Serial.println(Stheta[1]);
Serial.println(Stheta[2]);}
void loop()
{
}int fsegment(int theta[], int j)
{
int s=0;
do{
theta[j]=theta[j]/75;
s++;
}while(theta[j]>0);return s-1;
}void S(int theta[], int segment[], int Stheta[])
{
Stheta[0] = theta[0];
Stheta[1] = theta[1];
Stheta[2] = theta[2];
}
inside setup i printed various values to console to see where things were going wrong.
and inside function S() i set Stheta[j] = theta[j] ; so then in the console, the Stheta[] values should be the same as the theta[] values. but they're not. i have no idea why.
console:
60
90
0
0
1
0
0
0
0
arduino IDE v1.0.6