GithubHelp home page GithubHelp logo

arduino-softpwm's People

Contributors

alanaasmaa avatar davorvr avatar dragon-knight avatar kaworu avatar palatis avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-softpwm's Issues

Example does not compile

Getting this error compiling sample code:

SoftPWM_example:65:41: error: 'PORTC0' was not declared in this scope
 SOFTPWM_DEFINE_CHANNEL(14, DDRC, PORTC, PORTC0);  //Arduino pin A0

I used parts of examples to test this in my own code and got the same error.

Thanks for the library, sorry you ran out of time on maintaining it!

Timer User Conflicts with AltSoftSerial

It appears as if AltSoftSerial is trying to use the same timer as SoftPWM. PlatformIO is spitting out the following on compilation:

AltSoftSerial.cpp.o (symbol from plugin): In function `AltSoftSerial::read()':
(.text+0x0): multiple definition of `__vector_11'
.pioenvs/pro16MHzatmega328/src/main.cpp.o (symbol from plugin):(.text+0x0): first defined here

When I comment out any reference to SoftPWM, this error goes away. AltSoftSerial sets up which time it uses in AltSoftSerial_Boards based on the type of board chip. I'm using a Pro Mini. Is there another timer we can use? Thanks!

Problem when using Servo.h

Hello,

After i include #include <Servo.h> to your example compilation fails:
Arduino: 1.8.5 (Windows 7), Board: "Arduino Nano, ATmega328P"

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount':

(.text+0x0): multiple definition of `__vector_11'

sketch\SoftPWM_example.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Nano.

Add license information

It would be nice to have license information. Thanks so much for this excellent library! I've been using it for a couple years now.

Updating fast seems to break it

with

void loop() {
    Palatis::SoftPWM.set(11, 100);
}

The built-in LED does not light.

with

void loop() {
    Palatis::SoftPWM.set(11, 100);
    delay(1);
}

it does light. Of course, normally you wouldn't be able to update this fast.

Full code (adapted from example):


#include <Streaming.h>

#include <SoftPWM.h>

// I wanted 12 channels, moved things a bit
SOFTPWM_DEFINE_CHANNEL(0, DDRB, PORTB, PORTB3);  //Arduino pin 11
SOFTPWM_DEFINE_CHANNEL(1, DDRB, PORTB, PORTB4);  //Arduino pin 12
SOFTPWM_DEFINE_CHANNEL(2, DDRD, PORTD, PORTD2);  //Arduino pin 2
SOFTPWM_DEFINE_CHANNEL(3, DDRD, PORTD, PORTD3);  //Arduino pin 3
SOFTPWM_DEFINE_CHANNEL(4, DDRD, PORTD, PORTD4);  //Arduino pin 4
SOFTPWM_DEFINE_CHANNEL(5, DDRD, PORTD, PORTD5);  //Arduino pin 5
SOFTPWM_DEFINE_CHANNEL(6, DDRD, PORTD, PORTD6);  //Arduino pin 6
SOFTPWM_DEFINE_CHANNEL(7, DDRD, PORTD, PORTD7);  //Arduino pin 7
SOFTPWM_DEFINE_CHANNEL(8, DDRB, PORTB, PORTB0);  //Arduino pin 8
SOFTPWM_DEFINE_CHANNEL(9, DDRB, PORTB, PORTB1);  //Arduino pin 9
SOFTPWM_DEFINE_CHANNEL(10, DDRB, PORTB, PORTB2);  //Arduino pin 10
SOFTPWM_DEFINE_CHANNEL(11, DDRB, PORTB, PORTB5);  //Arduino pin 13

SOFTPWM_DEFINE_OBJECT_WITH_PWM_LEVELS(12, 256);


void setup() {
  Serial.begin(19200);

  // begin with 60hz pwm frequency
  Palatis::SoftPWM.begin(60);

  // print interrupt load for diagnostic purposes
  Palatis::SoftPWM.printInterruptLoad();
  // about 149.49 clocks per interrupt, UNO

}

void loop() {
  Palatis::SoftPWM.set(11, 100);
  delay(1); // needed or doesn't light LED
}

README formatting

I think something went wrong with the markdown in the readme, it's quite hard to read that way. Maybe it is worth checking

PWM on TX pin?

In your example you are generating PWM signal on 20 channels and one of them is PD1 which is TX pin so I expected garbage in the terminal but there wasn't any although I tried various serial speeds in both the firmware setting and the terminal setting :-/ How is that possible and how can Serial.print() work in the same time (and without any interference) with software PWM on TX pin?

BTW, it would be great if you added the fade in/out parameters as in the other one SoftPWM library. Fade out is useful not only for driving LEDs but for driving DC motors as well.

DISABLE PWM CHANNEL

I have used 8A designed for 6 channel PWM+ Servo in 1 pin, unfortunately , . The problem is that it must be dynamic switching mode between PWM and servo for each pin. How would I do that ?

I have try set PWM command to 0 and servo.attach() , not working.
Any idea?
I think we can work around by setting a function to mask out the channel in SoftPWM::update() ?

Servo.h and palatisSoftpwm.h conflicting on Arduino Esplora

In my project I need to add both the libraries Servo.h and palatisSoftPWM.h but the problem is:
multiple definition of `__vector_17'
I know that I could use the Servotimer2 but Arduino Esplora isn't compatible with it. How can I fix my issue? Thank you very much <3<3<3<3

Example is not working.

Thank you for the arduino-softpwm library, I like the way it works.

I use it for an ATmega8 by adding "#define TIMSK1 TIMSK".

The example was confusing for me, because the external definition "SOFTPWM_DEFINE_EXTERN_OBJECT_WITH_PWM_LEVELS" is also defined, but not needed for the example.

The example in the loop() is not working. My setup() takes about 10 seconds, therefor micros() has a high value when entering the loop(). The for-loop with 'i' stays at '0' and never gets to the next one. A value is added to micros() with "micros() + WAIT", that introduces the rollover problem. Could you rewrite the example and make it much simpler ? For example a ramp up for each output one by one with normal delays.

For motors it might be useful to have an example that uses an increasing frequency to find the frequency that is the least audible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.