I see one problem... you assume that LOW is 0 and probably that HIGH is 1. Although that may be right, you should be consistent in your code to prevent problems that are hard to track down.
so this:
int inspectiondone = 0;
and this:
while(inspectiondone == LOW){
May not give you the expected results. I know this is not the problem, it's just an advice.
Then the other thing I see is infinite loops... loads of them...
void loop(){ //you read the pins once...
startbutton = digitalRead(inspectready);
motorstop = digitalRead(stopmotor);
inspectiondone = digitalRead(inspectstop);
while(inspectiondone == LOW){ //then if inspectiondone goes low, you have one infinite loop here...
while (startbutton = HIGH){ //then you assign startbutton and therefore, you'll have another infinite loop here---
if(startbutton = HIGH){
digitalWrite(camera, HIGH);
digitalWrite(light, HIGH);
digitalWrite(motorcw, HIGH);
}
while (startbutton == HIGH) {//this is another infinite loop and a redundant one...
if (startbutton == HIGH){
digitalWrite(camera, HIGH);
digitalWrite(light, HIGH);
digitalWrite(motorccw, HIGH);
}
else if (motorstop == HIGH) {
digitalWrite(camera, LOW);
digitalWrite(light, LOW);
digitalWrite(motorcw, LOW);
digitalWrite(motorccw, LOW);
}}
}}
}
Can you try this?
void loop(){
while((inspectiondone=digitalRead(inspectstop)) == LOW){
if ((startbutton=digitalRead(inspectready)) == HIGH){
digitalWrite(camera, HIGH);
digitalWrite(light, HIGH);
digitalWrite(motorccw, HIGH);
}
else if ((motorstop= digitalRead(stopmotor)) == HIGH) {
digitalWrite(camera, LOW);
digitalWrite(light, LOW);
digitalWrite(motorcw, LOW);
digitalWrite(motorccw, LOW);
}}
}}
}
I did not understand your conditions to start and stop the motor... but I think you are complicating things way too much for what you described. Either way, you don't have infinite cycles in the code now.