1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
double __var__69_108_32_103_246_114_252_110_100_252_32_109_252_63;
float getDistance(int trig,int echo){
pinMode(trig,OUTPUT);
digitalWrite(trig,LOW);
delayMicroseconds(2);
digitalWrite(trig,HIGH);
delayMicroseconds(10);
pinMode(echo, INPUT);
return pulseIn(echo,HIGH,30000)/58.0;
}
Servo servo_10;
void setup(){
servo_10.attach(10);
__var__69_108_32_103_246_114_252_110_100_252_32_109_252_63 = 0;
if((getDistance(4,5)) < (20)){
__var__69_108_32_103_246_114_252_110_100_252_32_109_252_63 += 1;
if((getDistance(4,5)) < (20)){
__var__69_108_32_103_246_114_252_110_100_252_32_109_252_63 += -1;
}
}
if(((__var__69_108_32_103_246_114_252_110_100_252_32_109_252_63)==(1))){
servo_10.write(90);
}
if(((__var__69_108_32_103_246_114_252_110_100_252_32_109_252_63)==(0))){
servo_10.write(-90);
}
}
void loop(){
_loop();
}
void _delay(float seconds){
long endTime = millis() + seconds * 1000;
while(millis() < endTime)_loop();
}
void _loop(){
}
the code is this and the error is this
program Files (x86)\mBlock\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\SoftwareSerial C:\Users\poyra\AppData\Local\Temp\build438859862090385590.tmp\project_PROJEP_1.SB27_4.cpp -o C:\Users\poyra\AppData\Local\Temp\build438859862090385590.tmp\project_PROJEP_1.SB27_4.cpp.o
project_PROJEP_1.SB27_4.ino:18:1: error: 'Servo' does not name a type
project_PROJEP_1.SB27_4.ino: In function 'void setup()':
project_PROJEP_1.SB27_4.ino:23:5: error: 'servo_10' was not declared in this scope
'Servo' does not name a type