-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharduinoSerial.h
More file actions
49 lines (45 loc) · 1.13 KB
/
Copy patharduinoSerial.h
File metadata and controls
49 lines (45 loc) · 1.13 KB
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
/*
* Project name: Food collection
* Version 4
* Student : Albert Eduard Merino Pulido
*/
#ifndef arduino_h
#define arduino_h
#include <stdint.h> // Standard types
#include <stdio.h> // Standard input/output definitions
#include <unistd.h> // UNIX standard function definitions
#include <fcntl.h> // File control definitions
#include <errno.h> // Error number definitions
#include <termios.h> // POSIX terminal control definitions
#include <cstring> // String function definitions
#include <sys/ioctl.h>
#include <iostream>
using namespace std;
typedef struct Sensor {
int camera_direction;
int sel;
int texture;
int distance;
int direction;
int velocity;
Sensor();
} Sensor;
class ArduinoSerial {
public:
char * serialport;
int baudrate;
int fd;
char eolchar;
int timeout;
bool reading;
ArduinoSerial(char *, int, char);
void serialport_init();
int serialport_close();
bool serialport_write(uint8_t);
bool serialport_read(char *, int);
int serialport_flush();
bool isConnected();
bool isReading();
void setReading(bool);
};
#endif // ifndef arduino_h