-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpio.hpp
62 lines (54 loc) · 926 Bytes
/
gpio.hpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef GPIO_HPP
#define GPIO_HPP
#include "wiringPi.h"
#include "wiringSerial.h"
#include <iostream>
#include <sstream>
#include <string>
#include <unistd.h>
extern int task_flag;
class Gpio
{
public:
int fd;
int baud_rate;
public:
Gpio()
{
}
~Gpio()
{
serialClose(fd);
}
int init(int baud);
int setbit(int io,int action);
int serial_receive();
int serial_transmit(int status,float x,float y,float z);
void show_baud_rate();
int scan();
};
#define RED 0
#define GREEN 2
#define BLUE 3
#define SLOW 0
#define FAST 1
#define ON 1
#define OFF 0
class Light
{
private:
int RED_status;
int GREEN_status;
int BLUE_status;
public:
Light()
{
RED_status=OFF;
GREEN_status=OFF;
BLUE_status=OFF;
}
void blink(int color,int speed);
void turn_on(int color);
void turn_off(int color);
};
#endif // GPIO_HPP