-
Notifications
You must be signed in to change notification settings - Fork 8
/
arduino.h
76 lines (52 loc) · 1.22 KB
/
arduino.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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Author: Manash
// License: MIT
#ifndef ARDUINO_H
#define ARDUINO_H
#include <QDialog>
#include <QString>
#include <QtSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QMessageBox>
#include <QKeyEvent>
namespace Ui {
class Arduino;
}
class Arduino : public QDialog
{
Q_OBJECT
public:
explicit Arduino(QWidget *parent = 0);
~Arduino();
public slots:
void setPortName();
void setBaudRate();
void connectArduino();
// Controls
void forward();
void backward();
void left();
void right();
void stop();
private slots:
// void on_speedPushButton_clicked();
void on_forwardButton_clicked();
void on_aboutButton_clicked();
void on_leftButton_clicked();
void on_rightButton_clicked();
void on_backwardButton_clicked();
void on_stopButton_clicked();
void on_highspeed_clicked();
void on_mediumspeed_clicked();
void on_lowspeed_clicked();
private:
Ui::Arduino *ui;
QSerialPort *arduino;
QString currentPort;
QList <QString> baudRateList;
QList <QSerialPortInfo> ports;
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *e);
QByteArray speed;
int baudRate;
};
#endif // ARDUINO_H