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 AnalogIn pot(p16); 00004 DigitalOut led(LED1); 00005 00006 Serial pc(USBTX,USBRX); 00007 00008 Ticker tick; 00009 00010 00011 float Vav=0.0; 00012 00013 void average (void) { 00014 led = !led; 00015 Vav = (Vav + pot)/2.0; 00016 } 00017 00018 00019 int main() { 00020 00021 // run the ticker every 100ms 00022 tick.attach(&average,0.1); 00023 00024 while (1) { 00025 pc.printf("Average is %.3f\n",Vav); 00026 wait (2.0); 00027 00028 } 00029 }
Generated on Sat Jul 16 2022 17:45:54 by
1.7.2