Skip to content
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

Enable PwmOut pins in nano #48

Open
giowild opened this issue May 22, 2017 · 1 comment
Open

Enable PwmOut pins in nano #48

giowild opened this issue May 22, 2017 · 1 comment

Comments

@giowild
Copy link
Collaborator

giowild commented May 22, 2017

Would be nice to let app developers configure a pin as PWMOut in Nano. Current Nano firmware thus needs modifications.

Each PWMOut pin may be configured with two parameters:

  • period in microseconds, as int
  • and duty cicle as percentage: float [0-1]

This configuration should be sent after the pin initialization

	public void onBoardInitEnded() {
		nanoPwmPin.setStatus(BLEGeneralIO.GENERAL_IO_PWM);
                nanoPwmPin.setPeriod(10000000),
                nanoPwmPin.setDutyCicle(0.2),
	}

EXTRA: check if Arduino/Raspberry pins can be set as PWM pins and integrate them too!

@giowild
Copy link
Collaborator Author

giowild commented Jul 4, 2017

Hot to generate a PWMOut for RedBear Nano, from mbed IDE:

#include "mbed.h"

PwmOut led(P0_4);

int main() {
    led.period_ms(10);
    led.write(0.032);
    while(1) {
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant