для управления турелью

Dependencies:   mbed

Committer:
Yar
Date:
Thu Jan 19 05:22:19 2017 +0000
Revision:
3:e47c0c98f515
MPU6050

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yar 3:e47c0c98f515 1 #include "led_color.hpp"
Yar 3:e47c0c98f515 2 #include "mbed.h"
Yar 3:e47c0c98f515 3 #include "main.hpp"
Yar 3:e47c0c98f515 4
Yar 3:e47c0c98f515 5 DigitalOut redLed(PIN_LED_RED);
Yar 3:e47c0c98f515 6 DigitalOut greenLed(PIN_LED_GREEN);
Yar 3:e47c0c98f515 7 DigitalOut blueLed(PIN_LED_BLUE);
Yar 3:e47c0c98f515 8
Yar 3:e47c0c98f515 9 // конструктор класса управления светодиодом состояния
Yar 3:e47c0c98f515 10 StateLed::StateLed(void) {
Yar 3:e47c0c98f515 11 // по умолчанию светодиод выключен
Yar 3:e47c0c98f515 12 redLed = 0;
Yar 3:e47c0c98f515 13 greenLed = 0;
Yar 3:e47c0c98f515 14 blueLed = 0;
Yar 3:e47c0c98f515 15 }
Yar 3:e47c0c98f515 16
Yar 3:e47c0c98f515 17 StateLed::~StateLed(void) {
Yar 3:e47c0c98f515 18 redLed = 0;
Yar 3:e47c0c98f515 19 greenLed = 0;
Yar 3:e47c0c98f515 20 blueLed = 0;
Yar 3:e47c0c98f515 21 }
Yar 3:e47c0c98f515 22
Yar 3:e47c0c98f515 23 // функции устанавливают цвет светодиода
Yar 3:e47c0c98f515 24 void StateLed::setLedRed(void) {
Yar 3:e47c0c98f515 25 redLed = 1;
Yar 3:e47c0c98f515 26 greenLed = 0;
Yar 3:e47c0c98f515 27 blueLed = 0;
Yar 3:e47c0c98f515 28 }
Yar 3:e47c0c98f515 29
Yar 3:e47c0c98f515 30 void StateLed::setLedGreen(void) {
Yar 3:e47c0c98f515 31 redLed = 0;
Yar 3:e47c0c98f515 32 greenLed = 1;
Yar 3:e47c0c98f515 33 blueLed = 0;
Yar 3:e47c0c98f515 34 }
Yar 3:e47c0c98f515 35
Yar 3:e47c0c98f515 36 void StateLed::setLedBlue(void) {
Yar 3:e47c0c98f515 37 redLed = 0;
Yar 3:e47c0c98f515 38 greenLed = 0;
Yar 3:e47c0c98f515 39 blueLed = 1;
Yar 3:e47c0c98f515 40 }
Yar 3:e47c0c98f515 41
Yar 3:e47c0c98f515 42 void StateLed::setLedNull(void) {
Yar 3:e47c0c98f515 43 redLed = 0;
Yar 3:e47c0c98f515 44 greenLed = 0;
Yar 3:e47c0c98f515 45 blueLed = 0;
Yar 3:e47c0c98f515 46 }
Yar 3:e47c0c98f515 47
Yar 3:e47c0c98f515 48 void StateLed::setLedWhite(void) {
Yar 3:e47c0c98f515 49 redLed = 1;
Yar 3:e47c0c98f515 50 greenLed = 1;
Yar 3:e47c0c98f515 51 blueLed = 1;
Yar 3:e47c0c98f515 52 }