is it good so far?
No. You know. There is a compiler that will tell you whether the code is at least syntactically correct. You could use that instead of asking us all the time.
Not that I mind, but you'll find development is a lot quicker if help (in this case, the compiler) is right there in the room with you.
Names like sensorPin1 are OK, but they could be better. From that name, I have no idea what kind of sensor is connected to the pin.
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
pinMode(3, OUTPUT);
digitalWrite(3, HIGH);
You gave these pin numbers names. Use the names, so that if you have to change the number sometime in the future, you only have to change one line of code.
// calibrate during the first five seconds // this part i did not understand
while (millis() < 5000) {
sensorValue = analogRead(sensorPin);
// record the maximum sensor value
if (sensorValue > sensorMax) {
sensorMax = sensorValue;
}
// record the minimum sensor value
if (sensorValue < sensorMin) {
sensorMin = sensorValue;
}
}
This code is reading, for a period of 5 seconds, the data from the pin defined in sensorPin, to determine the minimum and maximum values that occur during that 5 second interval. The problem is that you don't have a variable called sensorPin. You have sensorPin1, sensorPin2, and sensorPin3. Which one of them should this code be reading?