turning
Dependencies: Rectangle Servo TextLCD mbed
Fork of FollowMeBot by
iRobot.h
00001 #ifndef __IROBOT__ 00002 #define __IROBOT__ 00003 00004 #include "mbed.h" 00005 00006 class iRobot 00007 { 00008 00009 public: 00010 00011 iRobot(PinName tx, PinName rx); 00012 void start(); 00013 void forward(); 00014 void reverse(); 00015 void left(); 00016 void right(); 00017 void stop(); 00018 void playsong(); 00019 void charger(); 00020 void changeSpeed(int speed); 00021 void receive_sensor(); 00022 char sensorCode(); 00023 int getAngle(); 00024 void turnAngle(int angle); 00025 00026 private: 00027 00028 // Create Command // Arguments 00029 static const char Start = 128; 00030 static const char SafeMode = 131; 00031 static const char FullMode = 132; 00032 static const char Drive = 137; // 4: [Vel. Hi] [Vel Low] [Rad. Hi] [Rad. Low] 00033 static const char DriveDirect = 145; // 4: [Right Hi] [Right Low] [Left Hi] [Left Low] 00034 static const char Demo = 136; // 2: Run Demo x 00035 static const char Sensors = 142; // 1: Sensor Packet ID 00036 static const char CoverandDock = 143; // 1: Return to Charger 00037 static const char SensorStream = 148; // x+1: [# of packets requested] IDs of requested packets to stream 00038 static const char QueryList = 149; // x+1: [# of packets requested] IDs of requested packets to stream 00039 static const char StreamPause = 150; // 1: 0 = stop stream, 1 = start stream 00040 static const char PlaySong = 141; 00041 static const char Song = 140; 00042 static const char BumpsandDrops = 7; 00043 static const char Distance = 19; 00044 static const char Angle = 20; 00045 static const char waitAngle = 157; 00046 /* Global variables with sensor packet info */ 00047 char Sensor_byte_count; 00048 char Sensor_Data_Byte; 00049 char Sensor_Data_Byte_Error; 00050 char Sensor_ID; 00051 char Sensor_Num_Bytes; 00052 char Sensor_Checksum; 00053 00054 int speed_left; 00055 int speed_right; 00056 Serial device; 00057 }; 00058 00059 #endif
Generated on Thu Jul 14 2022 17:03:57 by 1.7.2