RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
LED.h
Go to the documentation of this file.
1#pragma once
2#include <stdio.h>
3#include <wiringPi.h>
4#include "BaseComponent.h"
5
6namespace RumPi
7{
14 class LED : public BaseComponent
15 {
16
17 private:
18 /* WiringPi pin 0 is BCM_GPIO 17. we have to use BCM numbering when initializing
19 with wiringPiSetupSys when choosing a different pin number please use
20 the BCM numbering, also update the Property Pages - Build Events - Remote
21 Post-Build Event command which uses gpio export for setup for wiringPiSetupSys */
22
24 unsigned int myPinNumber;
25
26 public:
40 LED(unsigned int pinNumber);
41
53 virtual ~LED();
54
65 virtual void TurnOn() override;
66
77 virtual void TurnOff() override;
78
90 virtual void ProcessRawValues() override;
91
104 virtual std::string ToString() const override;
105
118 unsigned int GetPinNumber() const;
119
120 };
121} // namespace RumPi
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
A very simple standard LED, driven by a single GPIO pin.
Definition: LED.h:15
virtual void TurnOff() override
Turns the LED off (drives its pin low).
Definition: LED.cpp:67
unsigned int myPinNumber
The BCM GPIO pin this LED is driven on.
Definition: LED.h:24
virtual void ProcessRawValues() override
Processes the LED's raw values.
Definition: LED.cpp:83
virtual std::string ToString() const override
Serializes the LED's state (its pin number) to a string.
Definition: LED.cpp:99
virtual void TurnOn() override
Turns the LED on (drives its pin high).
Definition: LED.cpp:52
LED(unsigned int pinNumber)
Builds an LED on the given GPIO pin and sets that pin to output mode.
Definition: LED.cpp:18
virtual ~LED()
Destroys the LED.
Definition: LED.cpp:37
unsigned int GetPinNumber() const
Gets the GPIO pin the LED is driven on.
Definition: LED.cpp:121
RumPi is the library's top-level facade.
Definition: AlertManager.h:6