SAndroidEOfficial / framework

SAndroidE - Sensors for Android Embedded. A free framework allowing external devices to be easily managed in Android
http://es3.unibs.it/SAndroidE
Other
7 stars 1 forks source link

Enable PwmOut pins in nano #48

Open giowild opened 7 years ago

giowild commented 7 years ago

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:

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 commented 7 years ago

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) {
    }
}