Go Down

Topic: pueden ayudarme ? (Read 399 times) previous topic - next topic

tiketi69

Dec 19, 2018, 04:25 pm Last Edit: Dec 19, 2018, 10:57 pm by surbyte Reason: Errores y códigos deben ir con etiquetas
tengo un problema y no puedo resolverlo

Este es el sketch:

Leccion  5 Monitor Serial  Adafruit

Code: [Select]
int latchPin = 5;
int clockPin = 6;
int dataPin = 4;

byte leds = 0;

void setup()
{
 pinMode(latchPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 updateShiftRegister();
 Serial.begin(9600);
 while (! Serial);
 Serial.println(*Enter LED Number 0 to 7 or 'x' to clear*);        'Enter' was not declared in this scope
}   ERROR

void loop()
{
 if (Serial.available())
 {
   char ch = Serial.read();
   if (ch >= '0' && ch <= '7')
   {
     int led = ch - '0';
     bitSet(leds, led);
     updateShiftRegister();
     Serial.print(*Turned on LED*);
     Serial.println(led);
 }
 if (ch == 'x')
 {
   leds = 0;
   updateShiftRegister();
   Serial.println(*Cleared*);
   }
 }
}
void updateShiftRegister()
{
 digitalWrite(latchPin, LOW);
 shiftOut(dataPin, clockPin, LSBFIRST, leds);
 digitalWrite(latchPin, HIGH);
}



ERROR

Code: [Select]
Arduino:1.8.5 (Windows 7), Tarjeta:"Arduino Leonardo"

C:\Program Files\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\Arduino\hardware -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\Mantto\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -ide-version=10805 -build-path C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732 -warnings=none -build-cache C:\Users\Mantto\AppData\Local\Temp\arduino_cache_526208 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\Arduino\hardware\tools\avr -verbose H:\ARD\sketchs\lecc5_MonitorSerial\lecc5_MonitorSerial.ino
C:\Program Files\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files\Arduino\hardware -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\Mantto\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -ide-version=10805 -build-path C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732 -warnings=none -build-cache C:\Users\Mantto\AppData\Local\Temp\arduino_cache_526208 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\Arduino\hardware\tools\avr -verbose H:\ARD\sketchs\lecc5_MonitorSerial\lecc5_MonitorSerial.ino
Using board 'leonardo' from platform in folder: C:\Program Files\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\leonardo" "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\sketch\lecc5_MonitorSerial.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Program Files\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\leonardo" "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\sketch\lecc5_MonitorSerial.ino.cpp" -o "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\preproc\ctags_target_for_gcc_minus_e.cpp"
Compilando programa...
"C:\Program Files\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\leonardo" "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\sketch\lecc5_MonitorSerial.ino.cpp" -o "C:\Users\Mantto\AppData\Local\Temp\arduino_build_870732\sketch\lecc5_MonitorSerial.ino.cpp.o"
H:\ARD\sketchs\lecc5_MonitorSerial\lecc5_MonitorSerial.ino: In function 'void setup()':

lecc5_MonitorSerial:16: error: 'Enter' was not declared in this scope

  Serial.println(*Enter LED Number 0 to 7 or 'x' to clear*);

                  ^

H:\ARD\sketchs\lecc5_MonitorSerial\lecc5_MonitorSerial.ino: In function 'void loop()':

lecc5_MonitorSerial:29: error: 'Turned' was not declared in this scope

      Serial.print(*Turned on LED*);

                    ^

lecc5_MonitorSerial:36: error: 'Cleared' was not declared in this scope

    Serial.println(*Cleared*);

                    ^

lecc5_MonitorSerial:36: error: expected primary-expression before ')' token

    Serial.println(*Cleared*);

                            ^

exit status 1
'Enter' was not declared in this scope


evanmars


tiketi69

gracias lo voy a probar

surbyte

Primero intenta ir a

Ve a Documentación => Indice de temas tutoriales => Clases de Youtube

Presta atención e intenta entender como funciona este mundo de arduino. Como se programa y como resolver errores.

Los códigos de error que te figuran te dan toda la información

Tu has copiado un código correspondiente a la lección 5 y lo compiaste mal.
Todos tus errores son de tipeo en general.
Ejemplo: primer error
Code: [Select]
lecc5_MonitorSerial:29: error: 'Turned' was not declared in this scope

      Serial.print(*Turned on LED*);

                    ^

lecc5_MonitorSerial:36: error: 'Cleared' was not declared in this scope


Lo primero que dice es
lecc5_MonitorSerial:29: error: 'Turned' was not declared in this scope
29 es la linea
error: 'Turned' was not declared in this scope
Lo que quiere decir que el sistema interpreta que Turnes es una variable no declarada pero... si miras bien esta dentro de un Serial.print()
Y todo lo que va dentro de un Serial.print debe ir entre " "

Asi que lo correcto es

Code: [Select]
Serial.print("Turned on LED");


Lo mismo con el siguiente error

Code: [Select]
Serial.println(*Cleared*);

debe ser

Code: [Select]
Serial.println("Cleared");



Go Up