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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 #include "PinDetect.h" 00003 // Initialize a pins to perform analog input and digital output fucntions 00004 AnalogIn ain(A0); 00005 DigitalOut dout(D3); 00006 PinDetect pin(D2); 00007 char letter; 00008 char *lower_arr = " zyxwvutsrqponmlkjihgfedcba"; 00009 char *upper_arr = " ZYXWVUTSRQPONMLKJIHGFEDCBA"; 00010 char *arr = lower_arr; 00011 void enter(void) 00012 { 00013 printf("%c", letter); 00014 } 00015 00016 void capslock_on(void) { 00017 dout = !dout; 00018 } 00019 00020 int main(void) 00021 { 00022 dout = 0; 00023 pin.setSampleFrequency(); 00024 pin.attach_asserted(&enter); 00025 pin.attach_deasserted_held(&capslock_on); 00026 printf("\r\n Input here: \r\n "); 00027 while (1) { 00028 if (dout){ 00029 arr = upper_arr; 00030 } else { 00031 arr = lower_arr; 00032 } 00033 int input = (int)(ain.read()* 100.0f / 3.705f); 00034 letter = arr[input]; 00035 printf("%c", letter); 00036 printf("\b"); 00037 } 00038 }
Generated on Tue Jul 26 2022 02:43:29 by
1.7.2