turning

Dependencies:   Rectangle Servo TextLCD mbed

Fork of FollowMeBot by Daniel Hamilton

Committer:
dhamilton31
Date:
Mon Nov 25 19:55:12 2013 +0000
Revision:
3:de12b39ad805
Parent:
1:6c399fc35deb
Added additional servo control and printing commands to lcd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dhamilton31 0:3ed56271dd2d 1 #ifndef __IROBOT__
dhamilton31 0:3ed56271dd2d 2 #define __IROBOT__
dhamilton31 0:3ed56271dd2d 3
dhamilton31 0:3ed56271dd2d 4 #include "mbed.h"
dhamilton31 0:3ed56271dd2d 5
dhamilton31 0:3ed56271dd2d 6 class iRobot
dhamilton31 0:3ed56271dd2d 7 {
dhamilton31 0:3ed56271dd2d 8
dhamilton31 0:3ed56271dd2d 9 public:
dhamilton31 0:3ed56271dd2d 10
dhamilton31 0:3ed56271dd2d 11 iRobot(PinName tx, PinName rx);
dhamilton31 0:3ed56271dd2d 12 void start();
dhamilton31 0:3ed56271dd2d 13 void forward();
dhamilton31 0:3ed56271dd2d 14 void reverse();
dhamilton31 0:3ed56271dd2d 15 void left();
dhamilton31 0:3ed56271dd2d 16 void right();
dhamilton31 0:3ed56271dd2d 17 void stop();
dhamilton31 0:3ed56271dd2d 18 void playsong();
dhamilton31 0:3ed56271dd2d 19 void charger();
dhamilton31 1:6c399fc35deb 20 void changeSpeed(int speed);
dhamilton31 1:6c399fc35deb 21 void receive_sensor();
dhamilton31 1:6c399fc35deb 22 char sensorCode();
dhamilton31 3:de12b39ad805 23 int getAngle();
dhamilton31 3:de12b39ad805 24 void turnAngle(int angle);
dhamilton31 0:3ed56271dd2d 25
dhamilton31 0:3ed56271dd2d 26 private:
dhamilton31 0:3ed56271dd2d 27
dhamilton31 0:3ed56271dd2d 28 // Create Command // Arguments
dhamilton31 0:3ed56271dd2d 29 static const char Start = 128;
dhamilton31 0:3ed56271dd2d 30 static const char SafeMode = 131;
dhamilton31 0:3ed56271dd2d 31 static const char FullMode = 132;
dhamilton31 0:3ed56271dd2d 32 static const char Drive = 137; // 4: [Vel. Hi] [Vel Low] [Rad. Hi] [Rad. Low]
dhamilton31 0:3ed56271dd2d 33 static const char DriveDirect = 145; // 4: [Right Hi] [Right Low] [Left Hi] [Left Low]
dhamilton31 0:3ed56271dd2d 34 static const char Demo = 136; // 2: Run Demo x
dhamilton31 0:3ed56271dd2d 35 static const char Sensors = 142; // 1: Sensor Packet ID
dhamilton31 0:3ed56271dd2d 36 static const char CoverandDock = 143; // 1: Return to Charger
dhamilton31 0:3ed56271dd2d 37 static const char SensorStream = 148; // x+1: [# of packets requested] IDs of requested packets to stream
dhamilton31 0:3ed56271dd2d 38 static const char QueryList = 149; // x+1: [# of packets requested] IDs of requested packets to stream
dhamilton31 0:3ed56271dd2d 39 static const char StreamPause = 150; // 1: 0 = stop stream, 1 = start stream
dhamilton31 0:3ed56271dd2d 40 static const char PlaySong = 141;
dhamilton31 0:3ed56271dd2d 41 static const char Song = 140;
dhamilton31 0:3ed56271dd2d 42 static const char BumpsandDrops = 7;
dhamilton31 0:3ed56271dd2d 43 static const char Distance = 19;
dhamilton31 0:3ed56271dd2d 44 static const char Angle = 20;
dhamilton31 3:de12b39ad805 45 static const char waitAngle = 157;
dhamilton31 1:6c399fc35deb 46 /* Global variables with sensor packet info */
dhamilton31 1:6c399fc35deb 47 char Sensor_byte_count;
dhamilton31 1:6c399fc35deb 48 char Sensor_Data_Byte;
dhamilton31 1:6c399fc35deb 49 char Sensor_Data_Byte_Error;
dhamilton31 1:6c399fc35deb 50 char Sensor_ID;
dhamilton31 1:6c399fc35deb 51 char Sensor_Num_Bytes;
dhamilton31 1:6c399fc35deb 52 char Sensor_Checksum;
dhamilton31 0:3ed56271dd2d 53
dhamilton31 0:3ed56271dd2d 54 int speed_left;
dhamilton31 0:3ed56271dd2d 55 int speed_right;
dhamilton31 0:3ed56271dd2d 56 Serial device;
dhamilton31 0:3ed56271dd2d 57 };
dhamilton31 0:3ed56271dd2d 58
dhamilton31 0:3ed56271dd2d 59 #endif