Hello,
Excuse my English writing, I use the Google translator to write and to read you. The version of my original French text follows this translation.
After several tests used with a servo motor and two DC motors controlled with an H-bridge with the Arduino library "Servo" standard, 100% PWM pins are inoperative. The PWM mode all pins pass in binary 0 (off) or 1 (On) in two different ways (and I have not researched the reason for the difference).
So, after a command "ServoCommande.attach (...)" All PWM pins are in mode 0 Volt or 5 volts, there are more intermediate values. For the past with instructions values "analogWrite (Motor_1_ENA, Speed);"
- 0 to 254 = Off and 255 = On.
or
- 0 to 127 = Off and 128 to 255 = On.
I solve this problem in a very small change in your source code in the file "Servo.h" simply by placing in order crossing order "TIMERx". To be precise, I move "# define _useTimer5" and "_timer5," as follows:
The code:
«
// 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 ;
»
In the change like this:
«
// Say which 16 bit timers can be used and in what order
if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
define _useTimer1
define _useTimer3
define _useTimer4
define _useTimer5
typedef enum { _timer1, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ;
»
I work with Arduino Mega R2 and R3, but I guess the problem is the same with other cards and the order crossing "TIMERx" should also be revised:
from:
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer3
define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
»
for :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer1
define _useTimer3
typedef enum { _timer1, _timer3, _Nbr_16timers } timer16_Sequence_t ;
»
Etc.
With this simple change , I find the use of the normal PWM mode all pins.
So as I spent weeks researching and solve this problem, I guess I 'm not the only one is that you could include this change in your library.
If this is not possible , could you explain why?
I work with operating system GNU/Linux Kubuntu 12.04 64-bits and the Arduino IDE 1.0.5. and I use it for my tested the following products:
1 x Controller Arduino Mega R3:
http://dx.com/p/mega-2560-r3-atmega2560-16au-board-usb-cable-for-arduino-black-blue-215579
1 x Plate experimentation Circuit-Test MB -104 " breadboard ".
http://dx.com/p/solderless-breadboard-white-large-size-121529
1 x box has six 1.5V AA batteries ( 9V):
http://dx.com/p/6-x-aa-batteries-holder-with-dc2-1-power-jack-for-arduino-126413
1 x Power Adapter for Arduino , 9V , 1A, 100cm cable):
http://dx.com/p/arduino-9v-1a-power-adapter-black-2-flat-pin-plug-100cm-cable-126288
1 x Card screen LCD LCD1602 :
http://dx.com/p/1602a-16-x-2-lines-white-character-lcd-module-w-blue-backlight-dc-5v-151978
1 x VS1838B infrared sensor ( TSOP1838 ) :
http://dx.com/p/tsop1838-ir-infrared-37-9khz-receiver-18m-range-2-7-5-5v-135045
http://www.dipmicro.com/store/VS1838B
http://dx.com/s/1838
1 x Mini Remote Control MP3 category
http://dx.com/p/ir-remote-control-diy-kit-for-arduino-1-x-cr2025-136284
1 x ZL-3 Robot Raider Car Kits (2 x 6V DC 77RPM , engine mountings and fittings )
http://dx.com/p/zl-3-robot-raider-car-kits-for-arduino-153030
or :
2 x DC motor N20 ( DC 1.5V ~ 12V) with reduction gear :
1 x Motor Controller L298N (H- Bridge) for two DC motors or one stepper motor :
http://dx.com/p/l298n-stepper-motor-driver-controller-board-module-blue-149662
http://www.datasheetarchive.com/dlmain/Datasheets-5/DSA-95443.pdf
http://www.datasheetarchive.com/dlmain/Datasheets-25/DSA-480678.pdf
2 x Servo Toward Pro MG996R and Accessories:
http://dx.com/p/mg996r-metal-gear-digital-torque-servos-with-gears-and-parts-35763
or
2 x Mini Tower Pro SG90 Servo and Accessories:
http://dx.com/p/towerpro-sg90-mini-plastic-gear-steering-servo-3-pcs-set-187776
1 x module sensor ultrasonic transmitter HR- SC04 .
http://dx.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
Sincerely,
René
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Bonjour
Excuser mon anglais écrit, j'utilise le traducteur Google pour vous écrire et pour vous lire. La version de mon texte original en français suit la présente traduction.
Après plusieurs tests d'utilisation avec un servomoteur et deux moteurs à courant continu piloté avec un pont en H, avec la bibliothèque « Servo » standard d'Arduino, 100 % des broches PWM sont inopérants. Le mode PWM de toutes les broches passe en mode binaire 0 (Off) ou 1 (On) de deux manières différentes (et je n'ai pas fouillé le pourquoi de la différence).
Donc, après une commande « ServoCommande.attach (...); » toutes les broches PWM sont en mode 0 Volt ou 5 Volts, il n'y a plus de valeurs intermédiaires. Pour les valeurs passées avec les instructions « analogWrite (Motor_1_ENA, Speed); »
- de 0 à 254 = Off et 255 = On.
ou
- de 0 à 127 = Off et de 128 à 255 = On.
Je résous ce problème par une très petite modification de votre code source, dans le fichier « Servo.h », simplement en plaçant en ordre croisant l'ordre des "TimerX". Pour être précis, je déplace « #define _useTimer5 » et « _timer5, » de la manière suivante :
Le code :
«
// 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 ;
»
En le modifient comme ceci :
«
// Say which 16 bit timers can be used and in what order
if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
define _useTimer1
define _useTimer3
define _useTimer4
define _useTimer5
typedef enum { _timer1, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ;
»
Je travaille avec des cartes Arduino Mega R2 et R3, mais je présume que le problème est le même avec les autres cartes et que l'ordre croisant des "TimerX" devrait aussi être révisé :
De :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer3
define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
»
Pour :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer1
define _useTimer3
typedef enum { _timer1, _timer3, _Nbr_16timers } timer16_Sequence_t ;
»
Etc.
Avec ce simple changement, je retrouve l'usage normal du mode PWM sur toutes les broches.
Alors, comme j'ai passé des semaines à chercher et à résoudre ce problème, je présume que je ne suis pas le seul est-ce que vous pourriez inclure cette modification dans votre bibliothèque.
Si cela n'est pas possible, pourriez-vous m'expliquer pourquoi?
Je travaille avec le système d'exploitation GNU/Linux Kubuntu 12.04 64 bits et l'IDE Arduino 1.0.5. et j'utilise pour mes testes les produits suivants :
1 x Contrôleur Arduino Mega R3 :
http://dx.com/p/mega-2560-r3-atmega2560-16au-board-usb-cable-for-arduino-black-blue-215579
1 x Planche d'expérimentation Circuit-Test MB-104 « BreadBoard ».
http://dx.com/p/solderless-breadboard-white-large-size-121529
1 x Boîtier a 6 piles AA 1.5V (9V) et connecteur pour Arduino :
http://dx.com/p/6-x-aa-batteries-holder-with-dc2-1-power-jack-for-arduino-126413
1 x Adaptateur secteur pour Arduino, 9V, 1A, câble 100cm) :
http://dx.com/p/arduino-9v-1a-power-adapter-black-2-flat-pin-plug-100cm-cable-126288
1 x Carte a écran LCD LCD1602 :
http://dx.com/p/1602a-16-x-2-lines-white-character-lcd-module-w-blue-backlight-dc-5v-151978
1 x Capteur infrarouges VS1838B (TSOP1838) :
http://dx.com/p/tsop1838-ir-infrared-37-9khz-receiver-18m-range-2-7-5-5v-135045
http://www.dipmicro.com/store/VS1838B
http://dx.com/s/1838
1 x Mini télécommande type MP3 :
http://dx.com/p/ir-remote-control-diy-kit-for-arduino-1-x-cr2025-136284
ZL-3 Robot Raider Car Kits (2 x Moteur CC 3(削除) 18V 77RPM, supports et fixations) :
http://dx.com/p/zl-3-robot-raider-car-kits-for-arduino-153030
Ou :
2 x Moteur à courant continu N20 (CC 1.5V (削除ここまで)12V) avec engrenage réducteur :
http://dx.com/p/n20-diy-metal-gear-for-car-dc-motor-speed-regulating-motor-reducer-silver-golden-214121
1 x Contrôleur moteur L298N (H-Bridge) pour 2 moteurs CC ou 1 moteur Pas-A-Pas () :
http://dx.com/p/l298n-stepper-motor-driver-controller-board-module-blue-149662
http://www.datasheetarchive.com/dlmain/Datasheets-5/DSA-95443.pdf
http://www.datasheetarchive.com/dlmain/Datasheets-25/DSA-480678.pdf
2 x Servomoteur Toward Pro MG996R et accessoires :
http://dx.com/p/mg996r-metal-gear-digital-torque-servos-with-gears-and-parts-35763
ou
2 x Mini Servomoteur Tower Pro SG90 et accessoires :
http://dx.com/p/towerpro-sg90-mini-plastic-gear-steering-servo-3-pcs-set-187776
1 x Module ultrason émetteur capteur HR-SC04.
http://dx.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
Cordialement,
René
Hello,
Excuse my English writing, I use the Google translator to write and to read you. The version of my original French text follows this translation.
After several tests used with a servo motor and two DC motors controlled with an H-bridge with the Arduino library "Servo" standard, 100% PWM pins are inoperative. The PWM mode all pins pass in binary 0 (off) or 1 (On) in two different ways (and I have not researched the reason for the difference).
So, after a command "ServoCommande.attach (...)" All PWM pins are in mode 0 Volt or 5 volts, there are more intermediate values. For the past with instructions values "analogWrite (Motor_1_ENA, Speed);"
or
I solve this problem in a very small change in your source code in the file "Servo.h" simply by placing in order crossing order "TIMERx". To be precise, I move "# define _useTimer5" and "_timer5," as follows:
The code:
«
// 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 ;
»
In the change like this:
«
// Say which 16 bit timers can be used and in what order
if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
define _useTimer1
define _useTimer3
define _useTimer4
define _useTimer5
typedef enum { _timer1, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ;
»
I work with Arduino Mega R2 and R3, but I guess the problem is the same with other cards and the order crossing "TIMERx" should also be revised:
from:
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer3
define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
»
for :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer1
define _useTimer3
typedef enum { _timer1, _timer3, _Nbr_16timers } timer16_Sequence_t ;
»
Etc.
With this simple change , I find the use of the normal PWM mode all pins.
So as I spent weeks researching and solve this problem, I guess I 'm not the only one is that you could include this change in your library.
If this is not possible , could you explain why?
I work with operating system GNU/Linux Kubuntu 12.04 64-bits and the Arduino IDE 1.0.5. and I use it for my tested the following products:
1 x Controller Arduino Mega R3:
http://dx.com/p/mega-2560-r3-atmega2560-16au-board-usb-cable-for-arduino-black-blue-215579
1 x Plate experimentation Circuit-Test MB -104 " breadboard ".
http://dx.com/p/solderless-breadboard-white-large-size-121529
1 x box has six 1.5V AA batteries ( 9V):
http://dx.com/p/6-x-aa-batteries-holder-with-dc2-1-power-jack-for-arduino-126413
1 x Power Adapter for Arduino , 9V , 1A, 100cm cable):
http://dx.com/p/arduino-9v-1a-power-adapter-black-2-flat-pin-plug-100cm-cable-126288
1 x Card screen LCD LCD1602 :
http://dx.com/p/1602a-16-x-2-lines-white-character-lcd-module-w-blue-backlight-dc-5v-151978
1 x VS1838B infrared sensor ( TSOP1838 ) :
http://dx.com/p/tsop1838-ir-infrared-37-9khz-receiver-18m-range-2-7-5-5v-135045
http://www.dipmicro.com/store/VS1838B
http://dx.com/s/1838
1 x Mini Remote Control MP3 category
http://dx.com/p/ir-remote-control-diy-kit-for-arduino-1-x-cr2025-136284
1 x ZL-3 Robot Raider Car Kits (2 x 6V DC 77RPM , engine mountings and fittings )
http://dx.com/p/zl-3-robot-raider-car-kits-for-arduino-153030
or :
2 x DC motor N20 ( DC 1.5V ~ 12V) with reduction gear :
1 x Motor Controller L298N (H- Bridge) for two DC motors or one stepper motor :
http://dx.com/p/l298n-stepper-motor-driver-controller-board-module-blue-149662
http://www.datasheetarchive.com/dlmain/Datasheets-5/DSA-95443.pdf
http://www.datasheetarchive.com/dlmain/Datasheets-25/DSA-480678.pdf
2 x Servo Toward Pro MG996R and Accessories:
http://dx.com/p/mg996r-metal-gear-digital-torque-servos-with-gears-and-parts-35763
or
2 x Mini Tower Pro SG90 Servo and Accessories:
http://dx.com/p/towerpro-sg90-mini-plastic-gear-steering-servo-3-pcs-set-187776
1 x module sensor ultrasonic transmitter HR- SC04 .
http://dx.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
Sincerely,
René
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Bonjour
Excuser mon anglais écrit, j'utilise le traducteur Google pour vous écrire et pour vous lire. La version de mon texte original en français suit la présente traduction.
Après plusieurs tests d'utilisation avec un servomoteur et deux moteurs à courant continu piloté avec un pont en H, avec la bibliothèque « Servo » standard d'Arduino, 100 % des broches PWM sont inopérants. Le mode PWM de toutes les broches passe en mode binaire 0 (Off) ou 1 (On) de deux manières différentes (et je n'ai pas fouillé le pourquoi de la différence).
Donc, après une commande « ServoCommande.attach (...); » toutes les broches PWM sont en mode 0 Volt ou 5 Volts, il n'y a plus de valeurs intermédiaires. Pour les valeurs passées avec les instructions « analogWrite (Motor_1_ENA, Speed); »
ou
Je résous ce problème par une très petite modification de votre code source, dans le fichier « Servo.h », simplement en plaçant en ordre croisant l'ordre des "TimerX". Pour être précis, je déplace « #define _useTimer5 » et « _timer5, » de la manière suivante :
Le code :
«
// 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 ;
»
En le modifient comme ceci :
«
// Say which 16 bit timers can be used and in what order
if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
define _useTimer1
define _useTimer3
define _useTimer4
define _useTimer5
typedef enum { _timer1, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ;
»
Je travaille avec des cartes Arduino Mega R2 et R3, mais je présume que le problème est le même avec les autres cartes et que l'ordre croisant des "TimerX" devrait aussi être révisé :
De :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer3
define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
»
Pour :
«
elif defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
define _useTimer1
define _useTimer3
typedef enum { _timer1, _timer3, _Nbr_16timers } timer16_Sequence_t ;
»
Etc.
Avec ce simple changement, je retrouve l'usage normal du mode PWM sur toutes les broches.
Alors, comme j'ai passé des semaines à chercher et à résoudre ce problème, je présume que je ne suis pas le seul est-ce que vous pourriez inclure cette modification dans votre bibliothèque.
Si cela n'est pas possible, pourriez-vous m'expliquer pourquoi?
Je travaille avec le système d'exploitation GNU/Linux Kubuntu 12.04 64 bits et l'IDE Arduino 1.0.5. et j'utilise pour mes testes les produits suivants :
1 x Contrôleur Arduino Mega R3 :
http://dx.com/p/mega-2560-r3-atmega2560-16au-board-usb-cable-for-arduino-black-blue-215579
1 x Planche d'expérimentation Circuit-Test MB-104 « BreadBoard ».
http://dx.com/p/solderless-breadboard-white-large-size-121529
1 x Boîtier a 6 piles AA 1.5V (9V) et connecteur pour Arduino :
http://dx.com/p/6-x-aa-batteries-holder-with-dc2-1-power-jack-for-arduino-126413
1 x Adaptateur secteur pour Arduino, 9V, 1A, câble 100cm) :
http://dx.com/p/arduino-9v-1a-power-adapter-black-2-flat-pin-plug-100cm-cable-126288
1 x Carte a écran LCD LCD1602 :
http://dx.com/p/1602a-16-x-2-lines-white-character-lcd-module-w-blue-backlight-dc-5v-151978
1 x Capteur infrarouges VS1838B (TSOP1838) :
http://dx.com/p/tsop1838-ir-infrared-37-9khz-receiver-18m-range-2-7-5-5v-135045
http://www.dipmicro.com/store/VS1838B
http://dx.com/s/1838
1 x Mini télécommande type MP3 :
http://dx.com/p/ir-remote-control-diy-kit-for-arduino-1-x-cr2025-136284
ZL-3 Robot Raider Car Kits (2 x Moteur CC 3
(削除) 18V 77RPM, supports et fixations) :12V) avec engrenage réducteur :http://dx.com/p/zl-3-robot-raider-car-kits-for-arduino-153030
Ou :
2 x Moteur à courant continu N20 (CC 1.5V (削除ここまで)
http://dx.com/p/n20-diy-metal-gear-for-car-dc-motor-speed-regulating-motor-reducer-silver-golden-214121
1 x Contrôleur moteur L298N (H-Bridge) pour 2 moteurs CC ou 1 moteur Pas-A-Pas () :
http://dx.com/p/l298n-stepper-motor-driver-controller-board-module-blue-149662
http://www.datasheetarchive.com/dlmain/Datasheets-5/DSA-95443.pdf
http://www.datasheetarchive.com/dlmain/Datasheets-25/DSA-480678.pdf
2 x Servomoteur Toward Pro MG996R et accessoires :
http://dx.com/p/mg996r-metal-gear-digital-torque-servos-with-gears-and-parts-35763
ou
2 x Mini Servomoteur Tower Pro SG90 et accessoires :
http://dx.com/p/towerpro-sg90-mini-plastic-gear-steering-servo-3-pcs-set-187776
1 x Module ultrason émetteur capteur HR-SC04.
http://dx.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
Cordialement,
René