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.
Dependencies: PololuLedStrip mbed
EffectPlugs.cpp
00001 #include "EffectPlugs.h" 00002 00003 EffectPlugs::EffectPlugs(uint8_t _num, DigitalInOut *_pins) 00004 { 00005 num = _num; 00006 pins = _pins; 00007 00008 for (uint8_t i = 0; i < num; i++) 00009 { 00010 pins[i].input(); 00011 pins[i].mode(PullUp); 00012 } 00013 } 00014 00015 uint8_t EffectPlugs::pluggedConnection() 00016 { 00017 uint8_t connection = 0, foundConnection = 0; 00018 for (uint8_t i = 0; i < num; i++) 00019 { 00020 pins[i].output(); 00021 pins[i].write(0); 00022 00023 for (uint8_t j = i + 1; j < num; j++) 00024 { 00025 connection++; 00026 if (pins[j].read() == 0) 00027 foundConnection = connection; 00028 } 00029 pins[i].input(); 00030 pins[i].mode(PullUp); 00031 } 00032 return foundConnection; 00033 }
Generated on Tue Jul 19 2022 02:43:48 by
1.7.2