Besoin d'aide


#1

Bonjour à tous et à toutes, j'ai un problème sur mon code :

define ROTARY_ANGLE_SENSOR A0

define ADC_REF 3.3

define FULL_ANGLE 300//full value of the rotary angle is 300 degrees

int potPin=2;
int valPot=0;
int valpH=0;

include

void setup()
{
Serial.begin(9600);
}

void loop()
{
valPot=analogRead(A0);
if (valPot>=0 && valPot<=21){
valpH=1;
}
if (valPot>=22 && valPot<=43){
valpH=2;
}
if (valPot>=44 && valPot<=64){
valpH=3;
}
if (valPot>=65 && valPot<=86){
valpH=4;
}
if (valPot>=87 && valPot<=107){
valpH=5;
}
if (valPot>=108 && valPot<=129){
valpH=6;
}
if (valPot>=130 && valPot<=150){
valpH=7;
}
if (valPot>=151 && valPot<=171){
valpH=8;
}
if (valPot>=172 && valPot<=193){
valpH=9;
}
if (valPot>=194 && valPot<=214){
valpH=10;
}
if (valPot>=215 && valPot<=236){
valpH=11;
}
if (valPot>=237 && valPot<=257){
valpH=12;
}
if (valPot>=258 && valPot<=278){
valpH=13;
}
if (valPot>=279 && valPot<=300){
valpH=14;
}

int valPh=int(valPot*14/1024)+14;
Serial.print("The angle between the mark and the starting position: ");
Serial.println(valpH);

delay(500);

}

int getDegrees();
int sensor_value = analogRead(ROTARY_ANGLE_SENSOR);
float voltage = (float)sensor_value * ADC_REF / 1023;
float degrees = voltage * FULL_ANGLE / ADC_REF;
Serial.println(degrees);

quand j'essaie de le compiler, il m'affiche ça :

Arduino : 1.6.11 (Windows 10), Carte : "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\gtafan81\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2A03_0X0042 -ide-version=10611 -build-path C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\gtafan81\Documents\Arduino\Potentiometre\Potentiometre.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\gtafan81\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2A03_0X0042 -ide-version=10611 -build-path C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\gtafan81\Documents\Arduino\Potentiometre\Potentiometre.ino
Using board 'mega' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "C:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master\rgb_lcd.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master\rgb_lcd.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c" -o "nul"
Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp" -o "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
Compilation du croquis...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" "-IC:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp" -o "C:\Users\gtafan81\AppData\Local\Temp\build5cfce1cb8c5f0d1dfb1469f9397613c8.tmp\sketch\Potentiometre.ino.cpp.o"
Potentiometre:73: error: 'Serial' does not name a type

Serial.println(degrees);

^

Utilisation de la bibliothèque Grove_LCD_RGB_Backlight-master prise dans le dossier : C:\Users\gtafan81\Documents\Arduino\libraries\Grove_LCD_RGB_Backlight-master (legacy)
Utilisation de la bibliothèque Wire version 1.0 dans le dossier: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
exit status 1
'Serial' does not name a type

Pouvez-vous m'aider ?


#2

C'est bon problème réglé.