If you format it it will look like this which is a lot more readable...
PHP Code:
float hiTime;
float loTime;
int current;
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
loTime = (analogRead(2) / 3.2) - 30; // Read and scale control voltage , every 0.34 secs
// remove offset (-100) to correct speed
if (loTime < 0) loTime = 0;
hiTime = 340 - loTime; // hiTime is balance of 50µsec period (when MOSFET to be OFF)
if (hiTime < 0) hiTime = 0;
current = analogRead(0); // Obtain value to represent current through MOSFET (read from source resistor)
if (hiTime < 339) { // If above low limit, speed control
for (int i = 0; i < 1000; i++) {
digitalWrite(3, HIGH); // generate fast PWM burst of 1000 cycles
delayMicroseconds(hiTime);
digitalWrite(3, LOW);
delayMicroseconds(loTime);
}
} else { // If near low limit, stop motor
digitalWrite(3, HIGH);
delay(340);
}
}
The double parenthesis are needed as the first is closing the if else statement and the second is closing the main loop of the program.
The */ is just the end operator of a multi line comment.
PHP Code:
/* comment this code
And this code */
Hope that helps