Main Page | Class List | File List | Class Members

lego.hxx

00001 
00007 #ifndef _LEGO_HH_
00008 #define _LEGO_HH_
00009 
00010 #include "usb.h"
00011 #include <iostream>
00012 #include <string>
00013 
00015 #define LEGO_MOTOR_DIRECTION 0xe1
00016 #define LEGO_MOTOR_ON_OFF 0x21
00017 #define LEGO_MOTOR_POWER 0x13
00018 
00019 #define LEGO_DIR_REPLY 0x16
00020 #define LEGO_ONOFF_REPLY 0xd6
00021 #define LEGO_POWER_REPLY 0xe4
00022 
00024 
00030 #define LEGO_SELECT_MOTOR_A 0x01
00031 #define LEGO_SELECT_MOTOR_B 0x02
00032 #define LEGO_SELECT_MOTOR_C 0x04
00033 
00035 #define LEGO_FLIP_DIR 0x40
00036 #define LEGO_DIR_FORWARD 0x80
00037 
00038 #define LEGO_MOTOR_OFF 0x40
00039 #define LEGO_MOTOR_ON 0x80
00040 
00041 #define LEGO_POWER_SMALL 0x01
00042 #define LEGO_POWER_MEDIUM 0x02
00043 #define LEGO_POWER_HIGH 0x04
00044 
00046 #define LEGO_SOURCE_TYPE1 0x01
00047 #define LEGO_SOURCE_TYPE2 0x02
00048 #define LEGO_SOURCE_TYPE3 0x04
00049 
00050 
00051 #define OTHER_CODE(code) code|0x08
00052 
00053 namespace Lego
00054 {
00055 
00057 
00060   class LegoRobo{
00061     
00062     private:
00063       
00064         //The private members of the class object
00065         struct usb_dev_handle *lego_handle;
00066         struct usb_device *lego_device;
00067 
00068     public:
00071     LegoRobo();
00072 
00075     ~LegoRobo();
00076 
00080     int cheackalive();
00081 
00090     int setdirection(char motors,char flip,char setforward);
00091 
00099     int setonoff(char motors,char on_off);
00100     
00106     int setpower(char motors,char ptype,char level);
00107   
00108   };
00109 
00110 }
00111 
00112 #endif //end of lego.hh

Generated on Sun Oct 31 09:07:02 2004 for LegoRobo by doxygen 1.3.4