wifi for mbed2

Dependencies:   ESP8266Interface HTTPClient-SSL WebSocketClient mbed-rtos mbed

Committer:
jsmith352
Date:
Tue Dec 08 23:26:23 2015 +0000
Revision:
0:5d3ac3a545d0
WIFI for mbed2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jsmith352 0:5d3ac3a545d0 1 #include "mbed.h"
jsmith352 0:5d3ac3a545d0 2 // new class to play a note on Speaker based on PwmOut class
jsmith352 0:5d3ac3a545d0 3 #ifndef _SPEAKER_H
jsmith352 0:5d3ac3a545d0 4 #define _SPEAKER_H
jsmith352 0:5d3ac3a545d0 5 class Speaker
jsmith352 0:5d3ac3a545d0 6 {
jsmith352 0:5d3ac3a545d0 7 public:
jsmith352 0:5d3ac3a545d0 8 Speaker(PinName pin) : _pin(pin) {
jsmith352 0:5d3ac3a545d0 9 // _pin(pin) means pass pin to the Speaker Constructor
jsmith352 0:5d3ac3a545d0 10 }
jsmith352 0:5d3ac3a545d0 11 // class method to play a note based on PwmOut class
jsmith352 0:5d3ac3a545d0 12 void PlayNote(float frequency, float duration, float volume) {
jsmith352 0:5d3ac3a545d0 13 _pin.period(1.0/frequency);
jsmith352 0:5d3ac3a545d0 14 _pin = volume/2.0;
jsmith352 0:5d3ac3a545d0 15 wait(duration);
jsmith352 0:5d3ac3a545d0 16 _pin = 0.0;
jsmith352 0:5d3ac3a545d0 17 }
jsmith352 0:5d3ac3a545d0 18
jsmith352 0:5d3ac3a545d0 19 private:
jsmith352 0:5d3ac3a545d0 20 PwmOut _pin;
jsmith352 0:5d3ac3a545d0 21 };
jsmith352 0:5d3ac3a545d0 22
jsmith352 0:5d3ac3a545d0 23 #endif // _SPEAKER_H