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.
SwitchBaseClass.cpp
00001 #include "SwitchBaseClass.h" 00002 #include "mbed.h" 00003 00004 SwitchBaseClass::SwitchBaseClass(PinName pin) : _pin(pin) { 00005 } 00006 int SwitchBaseClass::On(void){ 00007 if(_pin == 0) { 00008 wait(0.1); 00009 if (_pin == 0){ 00010 return 0; 00011 } 00012 } 00013 return 1; 00014 } 00015 00016 int SwitchBaseClass::Off(void){ 00017 if (_pin ==1) { 00018 wait(0.1); 00019 if(_pin == 1){ 00020 return 0; 00021 } 00022 } 00023 return 1; 00024 } 00025 00026 int SwitchBaseClass::On_Off(void){ 00027 if(On() == 0){ 00028 for(int i = 0; i < 20; i++){ 00029 if(Off() ==0){ 00030 return 0; 00031 } 00032 } 00033 } 00034 return 1; 00035 }
Generated on Thu Jul 28 2022 20:33:29 by
1.7.2