smd.iotkit.ch
/
0-06-06-Uebung
6.6. Sobald kein magnetisches Feld mehr vorhanden, Akustisches Signal auslösen.
Diff: main.cpp
- Revision:
- 1:4df8cc0c6b73
- Parent:
- 0:76692683baea
--- a/main.cpp Sun Apr 26 13:40:01 2015 +0000 +++ b/main.cpp Fri Feb 01 10:14:53 2019 +0000 @@ -3,15 +3,15 @@ #include "mbed.h" // Hall Sensor -AnalogIn hallSensor( A2 ); +AnalogIn hallSensor( A3 ); // Summer (Buzzer) -PwmOut speaker( D7 ); +PwmOut speaker( D3 ); int main() { while(1) { - if ( hallSensor.read() > 0.1f ) + if ( hallSensor.read() > 0.6f ) { // Polizei Sirene speaker.period( 1.0 / 969.0 ); // 969 = Tonfrequenz in Hz