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.
Fork of mbed-os-example-mbed5-blinky by
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut led2(LED2); 00004 DigitalOut led3(LED3); 00005 DigitalIn pol1(USER_BUTTON); 00006 AnalogIn analog_value(A0); 00007 DigitalOut Pullup(A5); 00008 00009 //------------------------------------ 00010 // Hyperterminal configuration 00011 // 9600 bauds, 8-bit data, no parity 00012 //------------------------------------ 00013 00014 Serial pc(SERIAL_TX, SERIAL_RX); 00015 00016 DigitalOut myled(LED1); 00017 00018 int main() { 00019 Pullup = true; 00020 float Valor = 0; 00021 00022 pc.printf("Apreta el polsador quan hagis regulat el potenciometre !\n"); 00023 while(1){ 00024 00025 while(pol1==1){ 00026 } 00027 while(pol1==0){ 00028 Valor = analog_value.read(); // llegeix el valor de la entrada analogica A0 00029 Valor = Valor*5; 00030 pc.printf("%f\n", Valor); 00031 myled = !myled; 00032 while(pol1==0){ 00033 } 00034 } 00035 00036 } 00037 } 00038
Generated on Thu Jul 14 2022 07:50:30 by
1.7.2
