Pages: [1]   Go Down
Author Topic: 'Servo' does not name a type  (Read 967 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I keep getting 'Servo' does not name a type message everytime I tried to compile my code

Here is my code:
Code:
#inlude <Servo.h>

Servo s1;

int F1 = 0;

void setup() {
  s1.attach(2); // attaches the servos
  s1.writeMicroseconds(1500);
}

void loop() {
  int FV1 = analogRead(F1);
 
  // usable range for flex sensors
  if (FV1 < 200) FV1 = 200;
  else if (FV1 > 460) FV1 = 460;

  // servo timer map
  int timer1 = map(FV1, 0, 1023, 0, 2000);
}

Any idea to fix this problem?
Arduino Uno
Software: Arduino 1.0.3
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

simple misspelling.

change #inlude <Servo.h>

to #include <Servo.h>

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just went full retard smiley-eek, shame on me
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just went full retard smiley-eek, shame on me


No, it happens to all of us (well maybe not to PaulS), I call them brain farts. Some coding problems just have to have another set of eyeballs applied.  smiley-wink

Lefty
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Newer version of gcc gives a better error message:
Code:
build-uno/tmp.cpp:1:2: error: invalid preprocessing directive #inlude
build-uno/tmp.cpp:3:1: error: 'Servo' does not name a type
build-uno/tmp.cpp: In function 'void setup()':
build-uno/tmp.cpp:8:3: error: 's1' was not declared in this scope
build-uno/tmp.cpp: In function 'void loop()':
build-uno/tmp.cpp:20:7: warning: unused variable 'timer1' [-Wunused-variable]
Logged

Pages: [1]   Go Up
Jump to: