Hi gr0p3r,
I knocked up this test based on your supplied loop.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int photonum = 10;
Serial.println();
Serial.print("photonum = ");
Serial.println(photonum);
for(int i = 0; i < 180; i += 30){
Serial.print("Tilting to degrees: ");
Serial.println(i);
for(int motorrun = (360/photonum); motorrun < (360+(360/photonum)); motorrun = motorrun + (360/photonum)){
Serial.print("motorrun = ");
Serial.print(motorrun);
Serial.print(", map(motorrun, 0, 360, 0, photonum) = ");
int x =map(motorrun, 0, 360, 0, photonum);
Serial.println(x);
}
Serial.println("Tilt");
}
Serial.println("Exit");
while(1){
}
}
I altered this line
for(int motorrun = (360/photonum); motorrun <= (360+(360/photonum)); motorrun = motorrun + (360/photonum)){
changing the <= to just < and get this result
Tilting to degrees: 0
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Tilting to degrees: 30
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Tilting to degrees: 60
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Tilting to degrees: 90
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Tilting to degrees: 120
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Tilting to degrees: 150
motorrun = 90, map(motorrun, 0, 360, 0, photonum) = 1
motorrun = 180, map(motorrun, 0, 360, 0, photonum) = 2
motorrun = 270, map(motorrun, 0, 360, 0, photonum) = 3
motorrun = 360, map(motorrun, 0, 360, 0, photonum) = 4
Tilt
Exit
I think this is what you was after as it now only takes the 4 pictures and not 5.