Machine Vision Status TCP Server

Dependencies:   C12832 EthernetInterface mbed-rtos mbed ConfigFile

Committer:
dwini
Date:
Mon Jun 15 14:41:41 2015 +0000
Revision:
9:60ce5e733ea6
Parent:
8:845dfadaa70d
Add config file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dwini 8:845dfadaa70d 1 #include "Indication.h"
dwini 8:845dfadaa70d 2 #include "RGBStatusIndicator.h"
dwini 8:845dfadaa70d 3
dwini 8:845dfadaa70d 4 namespace MachineVision {
dwini 8:845dfadaa70d 5
dwini 8:845dfadaa70d 6 RGBStatusIndicator::RGBStatusIndicator(PinName red_pin, PinName green_pin, PinName blue_pin)
dwini 8:845dfadaa70d 7 : rOut(red_pin), gOut(green_pin), bOut(blue_pin) {
dwini 8:845dfadaa70d 8 initializeRGB();
dwini 8:845dfadaa70d 9 }
dwini 8:845dfadaa70d 10
dwini 8:845dfadaa70d 11 void RGBStatusIndicator::initializeRGB(void) {
dwini 8:845dfadaa70d 12 rOut.period(0.001); // set pwm period
dwini 8:845dfadaa70d 13 clearRGB();
dwini 8:845dfadaa70d 14 }
dwini 8:845dfadaa70d 15
dwini 8:845dfadaa70d 16 void RGBStatusIndicator::setRGB(int r, int g, int b) {
dwini 8:845dfadaa70d 17 rOut = r;
dwini 8:845dfadaa70d 18 gOut = g;
dwini 8:845dfadaa70d 19 bOut = b;
dwini 8:845dfadaa70d 20 }
dwini 8:845dfadaa70d 21
dwini 8:845dfadaa70d 22 void RGBStatusIndicator::clearRGB(void) {
dwini 8:845dfadaa70d 23 setRGB(255, 255, 255);
dwini 8:845dfadaa70d 24 }
dwini 8:845dfadaa70d 25
dwini 8:845dfadaa70d 26 void RGBStatusIndicator::setStatus(Indication indication) {
dwini 8:845dfadaa70d 27 switch (indication) {
dwini 8:845dfadaa70d 28 case OK:
dwini 8:845dfadaa70d 29 setRGB(255, 0, 255);
dwini 8:845dfadaa70d 30 break;
dwini 8:845dfadaa70d 31 case FAIL:
dwini 8:845dfadaa70d 32 setRGB(0, 255, 255);
dwini 8:845dfadaa70d 33 break;
dwini 8:845dfadaa70d 34 case CLEAR:
dwini 8:845dfadaa70d 35 clearRGB();
dwini 8:845dfadaa70d 36 break;
dwini 8:845dfadaa70d 37 }
dwini 8:845dfadaa70d 38 }
dwini 8:845dfadaa70d 39 }
dwini 8:845dfadaa70d 40