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 /*Program Example 3.4: Simple program to test KTIR slotted optosensor. Switches an LED according to state of sensor 00002 */ 00003 #include "mbed.h" 00004 DigitalOut redled(p5); 00005 DigitalIn opto_switch(p12); 00006 00007 int main() 00008 { 00009 while(1) { 00010 if (opto_switch==1) //input = 1 if beam interrupted 00011 redled = 1; //switch led on if beam interrupted 00012 00013 else 00014 redled = 0; //led off if no interruption 00015 } //end of while 00016 }
Generated on Wed Aug 3 2022 12:50:18 by
1.7.2