-
-
Notifications
You must be signed in to change notification settings - Fork 7k
PWM and Lib Servo bug #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
PWM and Lib Servo bug #1614
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File isn't closed before being released, it leaks. This test has been verified and tested many times.
Fixed a typo in the WebServer example.
Make USB Serial_::begin() function take an unsigned long argument for consistency with HardwareSerial. Signed-off-by: Paul Brook <[email protected]>
Add two argument form of Serial_::begin Signed-off-by: Paul Brook <[email protected]>
Updated constructor and dependent code, other minor fixes. Robot LCD examples all compile, but not yet tested against actual hardware.
Latest Adafruit_GFX fixes + moved GFX lib to utility folder
…ook-usb-serial-begin
Fix indentation (cosmetic)
Fix for #814, Memory Leak
…lose/destructed objects #814
add preference to enable/disable line numbers and make font change work
Fix the line number font rendering problem on the Mac. Now, the TextAreaLineNumbers class extends the TextAreaPainter and just overloads the paintLine method to make it render the line number instead of rendering the whole line. Other than that, the superclass' drawing code is used. So: the same drawing code that renders the source code text in the editor is now also being used to render the line numbers.
…ave a built-in LED. Fixes #758
removed pachube examples, added xively examples. changes to the Servo examples
Updated description of the file
Changed variable to unsigned long.
moved lcd.begin() to the beginnng of the setup() and fixed an issue that prevented the example from compiling. When calling lcd.write() with an argument of 0, the 0 must be cast a s a byte.
"index" variable name create conflicts with Arduino Due where "index" is a reserved word for Posix C.
Adding power connections, just to be thorough
Update HelloWorld.ino - Added two lines for documentation
Fix of a bug #2199
SPI: remove duplicate BarometricPressureSensor example
Can I build this pull request? |
Yes, you can! |
@LamiRene Sorry for the automated ArduinoBot comment. |
fix Descriptor.c
Signed-off-by: Arnav Gupta <[email protected]>
set correct max size for mega2560 (to address issue #2277)
Comment says ALT+s, code says ALT+l. This remedies that difference.
Fix typo in KeyboardLogout.ino
Change EthernetClient to use IANA recommended ephemeral port range
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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é