doppler shift / Mbed 2 deprecated 7021ver2

Dependencies:   mbed

main.cpp

Committer:
KINU
Date:
2020-12-23
Revision:
3:1883ea70d247
Parent:
2:98f6cc48ca3a
Child:
4:9fefb9f18f08

File content as of revision 3:1883ea70d247:

#include "mbed.h"

Serial pc(SERIAL_TX, SERIAL_RX);
Serial device(PA_9,PA_10);
 
int main(void)
{
  /* 変数の宣言 */
  int i;
  int decimal = 14;
  int binary[7]={0};
 
  /* 10進数の入力 
  printf("10進数 = ");
  scanf("%d", &decimal);*/
 
  /* 10進数→2進数の変換 */
  for(i=0;decimal>0;i++){
    binary[i] = decimal % 2;
    decimal = decimal / 2;
  }
 
  /* 2進数の出力 */
  printf(" 2進数 = ");
  int k = 8;
  while( k>0 ){
    printf("%d", binary[--k]);
  }
  printf("\n");
 
  return 0;
}