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(P0_11); /* Potentiometer middle pin connected to P0_11, other two ends connected to GND and 3.3V */ 00004 DigitalOut led(LED1); /* LED blinks with a delay based on the analog input read */ 00005 00006 int main() 00007 { 00008 float ain; /* Variable to store the analog input*/ 00009 00010 while(1) { 00011 ain = pot.read(); /* Read analog value (output will be any value between 0 and 1 */ 00012 led = 1; /* Switch ON LED */ 00013 wait(ain); /* Wait for 'ain' Seconds (maximum delay is 1 seconds)*/ 00014 led = 0; /* Switch Off LED */ 00015 wait(ain); /* Wait for 'ain' Seconds (maximum delay is 1 seconds)*/ 00016 } 00017 }
Generated on Tue Jul 12 2022 17:49:51 by
