-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLED.h
36 lines (33 loc) · 1.13 KB
/
LED.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/** Simple On-board LED flashing program - written by Derek Molloy
* simple OOP struture for the Exploring BeagleBone book
*
* This program uses all four LEDS and can be executed in three ways:
* makeLEDs on
* makeLEDs off
* makeLEDs flash (flash at time delay intervals)
* makeLEDs status (get the trigger status)
*
* Written by Derek Molloy for the book "Exploring BeagleBone: Tools and
* Techniques for Building with Embedded Linux" by John Wiley & Sons, 2014
* ISBN 9781118935125. Please see the file README.md in the repository root
* directory for copyright and GNU GPLv3 license information. */
#include<iostream>
#include<fstream>
#include<string>
#include<sstream>
using namespace std;
#define LED_PATH "/sys/class/leds/beaglebone:green:usr"
class LED{
private:
string path;
int number;
virtual void writeLED(string filename, string value);
virtual void removeTrigger();
public:
LED(int number);
virtual void turnOn();
virtual void turnOff();
virtual void flash(string delayms);
virtual void outputState();
virtual ~LED();
};