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 Versuch20 by
IRSensorK.cpp
00001 #include <cmath> 00002 #include "IRSensorK.h" 00003 00004 //------------------------------------------------------------------------------ 00005 00006 using namespace std; 00007 00008 IRSensorK::IRSensorK(AnalogIn& distance): 00009 00010 distance(distance) 00011 { 00012 00013 00014 } 00015 00016 IRSensorK::~IRSensorK() {} 00017 00018 //------------------------------------------------------------------------------ 00019 00020 int IRSensorK::read() 00021 { 00022 int d; 00023 00024 00025 00026 if (3300*(distance)> 400) { //3cm+ 00027 d=1; 00028 } else { 00029 d=0; 00030 } 00031 00032 return d; 00033 00034 }
Generated on Sun Jul 17 2022 11:46:13 by
