the instruction to change servo from 90 to 180 degrees does so with appropriate delay as instructed, the instruction to reverse the position from 180 to 90 degrees does not provide the requested delay, what must be changed?
void crossingflashing1(int valA1, int valA2) {
digitalWrite(Flash, HIGH);//turns on flasher board
for (pos = 90; pos <= 180; pos += 1) //the servo goes from 90 to 180 degreesin steps of 1 degree
{
myservo.write(pos);//controls the servo
delay(50);
crossingState = ST_ON1;
}
}
void crossingflashing4(int valA1, int valA2) {
digitalWrite(Flash, HIGH); // keeps the flasher on
delay(1000); //1 second delay
flashcount++;//adds 1 to the flashcount
if (valA1 > 200 || valA2 > 200) {
flashcount = 0;
crossingState = ST_FLASHING3;
}
else if (flashcount > 120) {
{
for (pos = 180; pos >= 90; pos -= 1) // goes from 180 to 90 in increments of 1 degree
myservo.write(pos);
delay(50);
}
crossingState = ST_OFF;
}
}
@Milwrick, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project See About the IDE 1.x category.
Please explain why it will not copy here? What happens? Does your post exceed 120000 (I think that that is the limit) characters? If the full code is indeed too big, you have two options:
Attach it.
Trim it down to the minimum that exhibits the unwanted behaviour.
this code works properly and moves the gate at the correct spped to the horizontal position; void crossingflashing1(int valA1, int valA2) {
digitalWrite(Flash, HIGH);//turns on flasher board
for (pos = 90; pos <= 180; pos += 1) //the servo goes from 90 to 180 degreesin steps of 1 degree
{
myservo.write(pos);//controls the servo
delay(50);
crossingState = ST_ON1;
this code drives the gate back up to verticle at warp speed; void crossingflashing3(int valA1, int valA2) {
digitalWrite(Flash, HIGH); // keeps the flasher on
delay(1000); //1 second delay
flashcount++;//adds 1 to the flashcount
if (valA1 < 200 && valA2 < 200 && flashcount > 5) {
{
for (pos = 180; pos >= 90; pos -= 1) // goes from 180 to 90 in increments of 1 degree
myservo.write(pos);
delay(50);
}
delay(3000);
crossingState = ST_OFF;
}
}