doppler shift / Mbed 2 deprecated 7021ver2

Dependencies:   mbed

Committer:
KINU
Date:
Wed Dec 23 06:51:02 2020 +0000
Revision:
3:1883ea70d247
Parent:
2:98f6cc48ca3a
Child:
4:9fefb9f18f08
1010

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ryouheitakamoto 0:303ad425d2ac 1 #include "mbed.h"
ryouheitakamoto 0:303ad425d2ac 2
KINU 1:03cb3b25065c 3 Serial pc(SERIAL_TX, SERIAL_RX);
KINU 1:03cb3b25065c 4 Serial device(PA_9,PA_10);
KINU 3:1883ea70d247 5
KINU 3:1883ea70d247 6 int main(void)
KINU 2:98f6cc48ca3a 7 {
KINU 3:1883ea70d247 8 /* 変数の宣言 */
KINU 3:1883ea70d247 9 int i;
KINU 3:1883ea70d247 10 int decimal = 14;
KINU 3:1883ea70d247 11 int binary[7]={0};
KINU 3:1883ea70d247 12
KINU 3:1883ea70d247 13 /* 10進数の入力
KINU 3:1883ea70d247 14 printf("10進数 = ");
KINU 3:1883ea70d247 15 scanf("%d", &decimal);*/
KINU 3:1883ea70d247 16
KINU 3:1883ea70d247 17 /* 10進数→2進数の変換 */
KINU 3:1883ea70d247 18 for(i=0;decimal>0;i++){
KINU 3:1883ea70d247 19 binary[i] = decimal % 2;
KINU 3:1883ea70d247 20 decimal = decimal / 2;
KINU 3:1883ea70d247 21 }
KINU 3:1883ea70d247 22
KINU 3:1883ea70d247 23 /* 2進数の出力 */
KINU 3:1883ea70d247 24 printf(" 2進数 = ");
KINU 3:1883ea70d247 25 int k = 8;
KINU 3:1883ea70d247 26 while( k>0 ){
KINU 3:1883ea70d247 27 printf("%d", binary[--k]);
KINU 3:1883ea70d247 28 }
KINU 3:1883ea70d247 29 printf("\n");
KINU 3:1883ea70d247 30
KINU 3:1883ea70d247 31 return 0;
KINU 2:98f6cc48ca3a 32 }
KINU 2:98f6cc48ca3a 33
KINU 2:98f6cc48ca3a 34
KINU 2:98f6cc48ca3a 35