#include <Servo.h>
int main()
{
Servo blue;
}
void setup()
{
blue.attach(9);
blue.write(180);
}
void loop() {
}
Why is the program kirking out?
Error message: blue was not declared in this scope.
#include <Servo.h>
int main()
{
Servo blue;
}
void setup()
{
blue.attach(9);
blue.write(180);
}
void loop() {
}
Why is the program kirking out?
Error message: blue was not declared in this scope.
Drop the main(), put the declation of Servo in setup() - basically, the error message is telling you it knows nothing about the Servo declaration in main() (which I am sure is overwritten anyhow by the IDE - main() is built for you behind the scenes).
The way you've written it, blue is a local variable in the main function. You probably want to declare it in the global scope, outside of any function.