NiboRoboLib 3.6 - NIBO Library
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
nibo
NIBO2.h
gehe zur Dokumentation dieser Datei
1
/*
2
NIBO2 library for ARDUINO
3
License: BSD-License
4
(c) 2013 by Nils Springob, nicai-systems
5
*/
6
7
#ifndef __NIBO2_H__
8
#define __NIBO2_H__
9
10
#if !defined (__AVR_ATmega128__)
11
#error NIBO2 "library should be used with a NIBO2 robot as board (ATmega128 MCU)"
12
#endif
13
14
22
enum
{
23
LED_OFF = 0,
24
LED_GREEN = 1,
25
LED_RED = 2,
26
LED_ORANGE = 3
27
};
28
29
30
enum
{
31
LINE_L = 0,
32
LINE_R = 1,
33
FLOOR_L = 2,
34
FLOOR_R = 3,
35
};
36
37
38
enum
{
39
FLOOR_PASSIVE = 0,
40
FLOOR_ACTIVE = 1,
41
FLOOR_DIFFERENTIAL =2
42
};
43
44
45
class
NIBO2Class
{
46
public
:
47
NIBO2Class
();
48
void
begin();
49
unsigned
int
getVoltage();
50
//void checkVoltage();
51
void
setLed(
unsigned
char
led,
unsigned
char
value);
52
unsigned
char
getLed(
unsigned
char
led);
53
void
setLedsIntensity(
int
light);
54
void
setHeadlightsIntensity(
int
light);
55
void
setDisplayIntensity(
int
light);
56
unsigned
int
getRandomSeed();
57
unsigned
int
getAnalog(
unsigned
char
adc_channel,
unsigned
char
active=0);
58
void
enableCopro();
59
void
disableCopro();
60
unsigned
char
getS3();
61
unsigned
char
getJP1();
62
};
63
64
extern
NIBO2Class
NIBO2;
65
66
67
68
/*---------------------------------------------------------------------------*/
69
70
class
EnginePartClass
{
71
private
:
72
unsigned
char
id;
73
public
:
74
EnginePartClass
(
unsigned
char
id
);
75
int
getTicks();
76
int
getSpeed();
77
int
getCurrent();
78
};
79
80
81
class
EngineClass
{
82
private
:
83
public
:
84
EnginePartClass
left;
85
EnginePartClass
right;
86
EngineClass
();
87
void
begin();
88
void
setPWM(
int
left,
int
right);
89
void
setSpeed(
int
left,
int
right);
90
void
setTargetAbs(
int
left,
int
right,
unsigned
int
speed);
91
void
setTargetRel(
int
left,
int
right,
unsigned
int
speed);
92
int
getTargetDist();
93
void
stop();
94
void
stopImmediate();
95
};
96
97
extern
EngineClass
Engine;
98
99
100
/*---------------------------------------------------------------------------*/
101
102
103
class
FloorSensorClass
{
104
public
:
105
FloorSensorClass
();
106
void
begin();
107
unsigned
int
get
(
unsigned
char
index,
unsigned
char
absolute=0);
108
unsigned
int
getRaw(
unsigned
char
index,
unsigned
char
variant);
109
unsigned
int
getL0(
unsigned
char
absolute=0) {
return
get
(LINE_L, absolute);}
110
unsigned
int
getR0(
unsigned
char
absolute=0) {
return
get
(LINE_R, absolute);}
111
unsigned
int
getL1(
unsigned
char
absolute=0) {
return
get
(FLOOR_L, absolute);}
112
unsigned
int
getR1(
unsigned
char
absolute=0) {
return
get
(FLOOR_R, absolute);}
113
void
calibrateWhite();
114
void
calibrateBlack();
115
void
storeCalibration();
116
};
117
118
extern
FloorSensorClass
FloorSensor;
119
120
121
/*---------------------------------------------------------------------------*/
122
123
124
class
DistanceSensorClass
{
125
private
:
126
public
:
127
DistanceSensorClass
();
128
void
begin();
129
void
beginMeasure();
130
void
beginReceiveRC5();
131
unsigned
int
get
(
unsigned
char
dir);
132
unsigned
char
transmitRC5(
unsigned
int
code);
133
unsigned
int
getLastRC5();
134
};
135
136
extern
DistanceSensorClass
DistSensor;
137
138
139
/*---------------------------------------------------------------------------*/
140
141
142
#endif
143
144
145
146
147
148
149
150
151
152
153
154
155
156
EnginePartClass
Definition:
NIBO2.h:70
NIBO2Class
Definition:
NIBO2.h:45
DistanceSensorClass
Definition:
NIBO2.h:124
EngineClass
Definition:
NIBO2.h:81
FloorSensorClass
Definition:
NIBO2.h:103
Erzeugt am Mit Jan 18 2017 00:18:52 für NIBO Library von
1.8.5