NiboRoboLib 3.6 - NIBObee Library
NIBObee.h
gehe zur Dokumentation dieser Datei
1 /*
2  NIBObee library for ARDUINO
3  License: BSD-License
4  (c) 2013 by Nils Springob, nicai-systems
5 */
6 
7 #ifndef __NIBOBEE_H__
8 #define __NIBOBEE_H__
9 
10 
18 #if (!defined (_NIBOBEE_)) && (!defined (ARDUINO_AVR_NIBOBEE))
19 #error "NIBObee library should be used with a NIBObee robot as board!"
20 #endif
21 
22 #define ON 1
23 #define OFF 0
24 
25 #define LED0 0
26 #define LED1 1
27 #define LED2 2
28 #define LED3 3
29 
30 
31 class NIBObeeClass {
32  public:
33  NIBObeeClass();
34  void begin();
35  unsigned int getVoltage();
36  void checkVoltage();
37  void setLed(int led, int value);
38  int getLed(int led);
39  unsigned int getAnalog(unsigned char adc_channel, unsigned char active=0);
40  unsigned int getRandomSeed();
41 };
42 
43 extern NIBObeeClass NIBObee;
44 
45 
46 /*---------------------------------------------------------------------------*/
47 
48 
50  private:
51  unsigned char id;
52  public:
53  EnginePartClass(unsigned char id);
54  void resetTicks();
55  int getTicks();
56  //int getSpeed();
57 };
58 
59 
60 /*---------------------------------------------------------------------------*/
61 
62 
63 class EngineClass {
64  public:
65  EnginePartClass left;
66  EnginePartClass right;
67  EngineClass();
68  void begin();
69  void setPWM(int left, int right);
70  void setSpeed(int left, int right);
71  void setTargetAbs(int left, int right, unsigned int speed);
72  void setTargetRel(int left, int right, unsigned int speed);
73  int getTargetDist();
74  void stop();
75  void stopImmediate();
76 };
77 
78 extern EngineClass Engine;
79 
80 
81 /*---------------------------------------------------------------------------*/
82 
83 
85  public:
87  void begin();
88  unsigned int get(unsigned char index, unsigned char absolute=0);
89  //unsigned int getRaw(unsigned char index, unsigned char variant);
90  unsigned int getL(unsigned char absolute=0);
91  unsigned int getC(unsigned char absolute=0);
92  unsigned int getR(unsigned char absolute=0);
93  void calibrateWhite();
94  void calibrateBlack();
95  void storeCalibration();
96 };
97 
98 extern LineSensorClass LineSensor;
99 
100 
101 /*---------------------------------------------------------------------------*/
102 
103 
105  private:
106  unsigned char id;
107  public:
108  FeelerSensorClass(unsigned char id);
109  void begin();
110  int get();
111 };
112 
113 extern FeelerSensorClass FeelerL;
114 extern FeelerSensorClass FeelerR;
115 
116 
117 /*---------------------------------------------------------------------------*/
118 
119 
120 enum {
121  SENSOR_DISABLED = 0,
122  SENSOR_PULSE = 1,
123  SENSOR_LOW = 2,
124  SENSOR_HIGH = 3
125 };
126 
128  private:
129  unsigned char id;
130  public:
131  ExtSensorClass(unsigned char id);
132  void begin();
133  void activate(unsigned char mode);
134  void deactivate();
135  unsigned int get(unsigned char absolute=0);
136  //unsigned int getRaw(unsigned char variant);
137 };
138 
139 extern ExtSensorClass ExtSensorL;
140 extern ExtSensorClass ExtSensorR;
141 
142 
143 #endif
Definition: NIBObee.h:84
Definition: NIBObee.h:49
Definition: NIBObee.h:104
Definition: NIBObee.h:127
Definition: NIBObee.h:31
Definition: NIBObee.h:63