Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years ago.
How to use
Hi, sorry for my very newbie question. I have created a mbed project, and added both files to my project.
I then included the .h file in my main.cpp file.
In my main function I added "PwmIn(PA_3);" but the compiler gives me an error as follows; Error: No default constructor exists for class "PwmIn" in "main.cpp", Line: 30, Col: 12
Can someone tell me what is wrong? I Clicked on the help link in the compiler and I don't understand what is wrong or what it is telling me.
What I would like is to add up to 6 RC inputs to my Nucleo STM32F411 board.
Thanks
Question relating to:
2 Answers
10 years ago.
Try
PwmIn myPwmIn(PA_3);
You make an object (myPwmIn, or any other name you like), of type PwmIn.
10 years ago.
Hi Glendon,
Can you post your code?
To use the PwmInRC library, it's pretty easy:
1) Import the ORIGINAL library by Simon Ford. My library one has been modified with a WDT in case my quadcopter lost link to my transmitter.
2) Declare the prototype:
Prototype
PwmInRC rxModules[5] = {p14, p15, p16, p17, p18};
3) If you are polling:
Use
RXPolled = rxModules[0].pulsewidth();
If you want your pulsewidth to be completely interrupt driven, you should modify the PwmInRC library accordingly to obtain the pulsewidth based on the interrupt action instead of a poll. However, you must consider mutex/semaphores for the RTOS to be fully compliant, as well ask keeping the ISR efficient.
Good luck, Ian =]
Hi Ian, I ended up working out what Eric mentioned here, but I am now more interested in your answer.
It seems like your library PwmInRC is different to PwmIn if I am not mistaken? I would like to use a WDT as well, for safety reasons (it's not a quadcopter though). I am not using an RTOS (zero experience with these) but have thought about it. Just don't think I know enough about the basics yet. I don't understand your prototype, why is it needed, where does it go, what is p14 etc. I think your 'Use' entry means the variable RXPolled will capture and contain a single pulsewidth each time I call it, is that correct? I envisage I need an update rate on multiple channels around 10Hz (every 100mS). Thanks very much for your post.
posted by 03 Sep 2015
.
posted by Adrian Rusu 13 Nov 2015