Pure Square Wave with duty ratio controller

30 Nov 2011

Hi there,

I am a completely new user of mbed, and currently I am using it for a part of my project. All I need from it is to create a square wave output with fixed frequency, and I am wondering if I can have an external controller to modify the duty ratio of the output. If so, what function and what kind of controller am I suppose to have?

Thanks, Joe

30 Nov 2011

You can use the PWM class to create your output. It allows changing the duty cycle programmatically, allowing you to use anything you want for controlling it. For example, you can use a potentiometer and read its current value via the ADC, and set the duty cycle accordingly.

01 Dec 2011

Thanks for the reply,

I think potentiometer is the way to go down, and I am not sure if my understanding is correct. Please verify.

1. AnalogIn (p15-p20)should be used to read the current 2. In code, the function to read current is simply (AnalogIn a(p18); a > 2.0)?

Thanks, Joe

01 Dec 2011

There is another concern as well!

In terms of the input current, from the manual, it says the limit is 0.0 - 3.3v. I am not sure what the limit is in terms of current.

Thanks, Joe