Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(D1,D0); 00004 00005 //int char2posit(char cha); 00006 //char posit2char(int posit); 00007 00008 char posit2char(int posit) 00009 { 00010 int as = posit+48; 00011 char ch = as; 00012 return ch ; 00013 } 00014 00015 int char2posit(char cha) 00016 { 00017 int as = cha; 00018 as = as-48; 00019 return as; 00020 } 00021 00022 int main() 00023 { 00024 int i = 53; 00025 char th='h'; 00026 while(1){ 00027 00028 pc.printf("****ch = %c\n",posit2char(i)); 00029 pc.printf("****int = %d\n\n",char2posit(posit2char(i))); 00030 wait(1); 00031 } 00032 } 00033 00034 00035 00036 /* 00037 char c; 00038 pc.printf("Enter a character: "); 00039 00040 // Reads character input from the user 00041 pc.scanf("%c", &c); 00042 00043 // %d displays the integer value of a character 00044 // %c displays the actual character 00045 pc.printf("ASCII value of %c = %d\n\n", c, c); 00046 00047 00048 00049 //int myInt = 48+i; 00050 // 00051 // //scanf("%d", myInt); 00052 // char ch = myInt; 00053 // 00054 // pc.printf("%c = %d\n",ch,myInt); 00055 // i++; 00056 // wait(0.75); 00057 */
Generated on Wed Aug 3 2022 01:22:06 by
1.7.2