Mario Simaremare / Mbed 2 deprecated g3_waterplay

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Flasher.cpp Source File

Flasher.cpp

00001 #include "Flasher.h"
00002 #include "mbed.h"
00003 
00004 Flasher::Flasher(PinName pin) : _pin(pin)
00005 {
00006     _pin = 0;
00007 }
00008 
00009 void Flasher::flash(int n)
00010 {
00011     for(int i=0; i<n*2; i++) {
00012         _pin = !_pin;
00013         wait(0.2);
00014     }
00015 }
00016 
00017 void Flasher::flash(int n, float delay, float waiting_time)
00018 {
00019     for(int i=0; i<n*2; i++) {
00020         _pin = !_pin;
00021         wait(delay);
00022     }
00023     wait(waiting_time);
00024 }
00025 
00026 void Flasher::danger_flash()
00027 {
00028     this->flash(3, 0.3, 3.0);
00029 }
00030 
00031 void Flasher::danger_flash_long()
00032 {
00033     this->flash(3, 0.3, 10.0);
00034 }
00035 
00036 void Flasher::water_flash()
00037 {
00038     this->flash(1, 0.2, 3.0);
00039 }
00040 
00041 void Flasher::salinity_flash()
00042 {
00043     this->flash(2, 0.2, 3.0);
00044 }