PWM に挑戦
Page last updated 24 Nov 2013, by .
0
replies
mbed に付いているLEDの明るさを変化させる。
include the mbed library with this snippet
#include "mbed.h"
PwmOut led(LED1);
int main()
{
while(1) {
for(float p = 0.0f; p < 1.0f; p += 0.1f) {
led = p;
wait(0.1);
}
}
}
21ピンを使ってやってみる
include the mbed library with this snippet
#include "mbed.h"
PwmOut led(p21);
int main()
{
while(1) {
for(float p = 0.0f; p < 1.0f; p += 0.1f) {
led = p;
wait(0.1);
}
}
}
Please log in to post comments.
