-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharduino.h
More file actions
39 lines (29 loc) · 719 Bytes
/
Copy patharduino.h
File metadata and controls
39 lines (29 loc) · 719 Bytes
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
#include <unistd.h> //Needed for I2C port
#include <fcntl.h> //Needed for I2C port
#include <sys/ioctl.h> //Needed for I2C port
#include <linux/i2c-dev.h> //Needed for I2C port
#include <stdio.h>
#include <time.h>
#include <stdint.h>
class Arduino {
int devFile;
int devAddr;
unsigned char buffer[4];
uint64_t getTimeUsec(){
struct timespec t;
clock_gettime(CLOCK_REALTIME,&t);
return (t.tv_sec)*1e6+(t.tv_nsec)/1e3;
}
void sendData();
void receiveData();
void printMessages();
public:
Arduino(int a);
//initialize the I2C connection. Needs to be called after obj creations
int init();
void setServo(int angle);
float getSonarDist();
void deInit();
~Arduino(){
}
};