El caso es que tengo problemas para cargar los bocetos que llevan librerias, no me terminan de compilar dando varios errores, en un ATMEGA 2560 compilan y suben bien.
The translation to English mentions booksellers, which makes no sense at all. What is your native language? It might be better if this were posted in your native language in the appropriate section for that language.
Fue un error de traducción, me refería a "Bibliotecas" del tipo servo.h
Al principio puse mi pregunta en un hilo que trataba sobre el Thinary Every Nano pero como han movido mi pregunta esta se ha quedado huérfana, estoy hablando de un Thinary Nano Every
La regla aquí es que una nueva pregunta tiene su propio tema, no debe agregarse al tema de otra persona, incluso si se trata de lo mismo. Hacer eso mantiene el foro ordenado.
¡Me reí cuando vi el error de traducción de las bibliotecas a los libreros!
(Espero que Google Translate no haya hecho un lío al traducir esto al español)
OK, so you are using a Nano Every and you are having a problem with libraries. Perhaps the libraries you are using are not designed to work with the Nano Every.
Moderador:
Since @PerryBebbington has moved this thread here (Spanish Forum) you must use spanish to answering.
Same warning to @@tresvdoble
Desde el momento que que @PerryBebbington ha movido el hilo aquí (Foro Español) uds deben usar español para responder.
Misma advertencia para @tresvdoble
@tresvdoble sube por favor tu sketch, indica en los comentarios de donde has descargado las librerías y podremos ayudarte.
Llevas 4 o 5 respuestas que no te ayudan porque simplemente no has posteado lo mas importante. El sketch.
Debes postear usando etiquetas (</>) . Click ahi, luego pegas el sketch, no lo hagas a la inversa.
No olvides indicar de donde sacaste las librerías. Si fueron obtenidas del Administrador de librerías simplemente lo indicas en el comentario.
Nuevamente pido disculpas por no cumplir las normas.
El boceto está sacado de la web de arduino del ejemplo Sweep para la libreria servo.h y esta está sacada desde Administrador de Librerias, pego el boceto:
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
}
Si claro que te falta, cuáles son los errores.
Eso es simple, tiene solo una librería que esta integrada normalmente al IDE.
El único error posible es que hayas arrastrado sin queres caracteres de la pagina Web.
No veo como ese código te pueda dar error o generar errores.
He probado el código en UNO y MEGA sin errores.
Me corrijo y ahora veo que la placa debe ser Thinary Nano Every
Ahora pruebo.
Yo no encuentro por ahora ese modelo si Nano Every
Es esta?
En el IDE me arroja
El Sketch usa 2636 bytes (5%) del espacio de almacenamiento de programa. El máximo es 49152 bytes.
Las variables Globales usan 65 bytes (1%) de la memoria dinámica, dejando 6079 bytes para las variables locales. El máximo es 6144 bytes.
Ahora si
Ahora comprendo el problema. Los timers del ATmega4808 no estan soportados por la libreria Servo.
tienes que crear una variante en la libreria.
aca tienes la librería
D:\Arduino\Bocetos\libraries\Servo\src\avr\Servo.cpp
Asi que tendras que generar lo necesario para que acepte
Este es ServoTimers.h que no contiene ATmega4808
// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
#define _useTimer1
#define _useTimer3
#define _useTimer4
typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t;
#elif defined(__AVR_ATmega32U4__)
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t;
#elif defined(__AVR_ATmega128__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega2561__)
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t;
#else // everything else
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
#endif
Busca el mas parecido e intenta agregarlo de este modo
// Say which 16 bit timers can be used and in what order
#elif defined(__AVR_ATmega4808__)
#define _useTimer1
#define _useTimer2
typedef enum { _timer1, _timer2, _Nbr_16timers } timer16_Sequence_t;
Gracias por tu esfuerzo, dame unos dias para asimilar todo lo que me has dicho y hacer algunas pruebas, tambien estoy tratando de comprender todo lo que hay en el siguiente enlace:
/*
Copyright (c) 2018 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Defines for 16 bit timers used with Servo library
*
*/
#ifndef __SERVO_TIMERS_H__
#define __SERVO_TIMERS_H__
#if !defined(SERVO_USE_TIMERB0) || !defined(SERVO_USE_TIMERB1) || !defined(SERVO_USE_TIMERB2) || !defined(SERVO_USE_TIMERB3)
#if defined(__AVR_ATmega808__) || defined(__AVR_ATmega1608__) \
|| defined(__AVR_ATmega3208__) || defined(__AVR_ATmega4808__) \
|| defined(NANO_EVERY_PINOUT) || defined(UNO_WIFI_REV2_PINOUT)
#define SERVO_USE_TIMERB1
#elif defined(__AVR_ATmega809__) || defined(__AVR_ATmega1609__) || defined(__AVR_ATmega3209__) || defined(__AVR_ATmega4809__)
#define SERVO_USE_TIMERB3
#else
#error "No timers allowed for Servo"
#endif
#endif
__attribute__ ((used)) static volatile TCB_t* _timer =
#if defined(SERVO_USE_TIMERB0)
&TCB0;
#endif
#if defined(SERVO_USE_TIMERB1)
&TCB1;
#endif
#if defined(SERVO_USE_TIMERB2)
&TCB2;
#endif
#if defined(SERVO_USE_TIMERB3)
&TCB3;
#endif
typedef enum {
timer0,
_Nbr_16timers
} timer16_Sequence_t;
#endif /* __SERVO_TIMERS_H__ */
Pero no se como mi boceto puede hacer uso de esa libreria o de como implementar las lineas necesarias en el archivo original ServoTimers.h
Y pensaba de que manera se podria incluir el codigo necesario en el archvo ServoTimers.h original del IDE o de como hacer uso directamente del archivo ServoTimers.h que hay en el repositorio del enlace que puse.
Para qué quieres hacer eso?
Tienes una librería que hace lo mismo sin cambiar nada. Usa la librería para este micro y listo
Simple y rápido.
Todo lo demás corre por tu cuenta.
has visto la librería porque no es solo cambiar esas lineas.
Los registros TCA y TCB son de 16 bits y admiten 4 timers o sea 2 de 8 bits.
ServoTimers. h puede que luzca similar pero Servo.cpp no se si es igual a Servo.cpp común a los AVR.
Ojo una cosa son los AVR de ATMEL y otra este ATmega4808 que obviamente es de Microchip. Me puedo equivocar pero no habia visto estructura desdoblada de los timers como en este caso.