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.
9 years ago.
アナログアウトがPA_4以外使えない
include the mbed library with this snippet
#include "mbed.h"
DigitalOut myled(LED1);
AnalogOut DAconvert1(PA_4);
int main() {
float i = 0;
while(1) {
myled = 1; // LED is ON
DAconvert1.write(i);
i = i+0.1;
wait(1); // 1000 ms
myled = 0; // LED is OFF
wait(1); // 1 sec
if(i > 1.1){
i=0;
}
}
}
この様なプログラムを書いてアナログアウトのテストをしたのですがピンのレイアウトでPA_4以外にPA_5とPA_6でも使えるのかと思い書き換えて動かすとアナログ出力がうまく出来てないようです。
どのようにしたらアナログアウトを2ピン以上使えるのか教えて頂けると助かります。
1 Answer
9 years ago.
こちらに類似のレポートがありました。
https://developer.mbed.org/questions/68474/Unknown-Shift-of-AnalogOut-Pins/
Quote:
Check User Manual, Solder bridges SB16 and SB18 link PA_6 and PA_5 to PB_6 and PB_7 respectively. Something to do with i2c compatibility with Arduino Uno. SB16 and SB18 need to be removed to 'float' PA_5 and PA_6.