Today (27.3.), I modified the robot´s original danceScript, removed some sound files from the code and switched printed texts to my own texts. I tried to get the robot to make in the shape of square figure. I couldn´t get that exactly right because of many reasons. The main reason was that the robot´s wheels weren´t calibrated wery well. When I put the robot to go forward it tilted to right all the time. Well, the main important was that I got my own texts in to the robot´s screen and playing the sounds that I wanted. I also modified the speed of the robot a little bit slower because the robot hit many times to walls and chairs. After I slowed the speed the robot worked quite well. And finally heres the original part of the code that has not been modified and after that the same part with modified:
|____________________________________________________________________________|| |
char danceScript[] = "S4L1R1S2F1B1S1\0";
int currentScript = 0; // what step are we at
int currentSong = 0; // keep track of the current song
static const int SONGS_COUNT = 3; // number of songs
char musics[][11] = {
"melody.sqm",
"menu.sqm",
"chase.sqm",
};
Robot.text("1. Use left and\n right key to switch\n song", 5, 5);
Robot.text("2. Put robot on the\n ground to dance", 5, 33);
void parseCommand(char dir, char duration) {
//convert the scripts to action
switch(dir) {
case 'L':
Robot.motorsWrite(-255, 255);
break;
case 'R':
Robot.motorsWrite(255, -255);
break;
case 'F':
Robot.motorsWrite(255, 255);
break;
case 'B':
Robot.motorsWrite(-255, -255);
break;
case 'S':
Robot.motorsStop();
break;
}
|____________________________________________________________________________|| |
char danceScript[] = "S1F2R1B1L1\0";
int currentScript = 0; // what step are we at
int currentSong = 0; // keep track of the current song
static const int SONGS_COUNT = 1; // number of songs
char musics[][11] = {
"menu.sqm",
};
Robot.text("Muokattu discobotti", 0, 10);
Robot.text("Koodi by J-P Keskinen", 0, 20);
Robot.text("Laita robot lattialle", 0, 30);
void parseCommand(char dir, char duration) {
//convert the scripts to action
switch(dir) {
case 'L':
Robot.turn(-90);
delay(1000);
break;
case 'R':
Robot.turn(90);
delay(1000);
break;
case 'F':
Robot.motorsWrite(150, 150);
delay(1000);
break;
case 'B':
Robot.motorsWrite(150, 150);
delay(1000);
break;
case 'S':
Robot.motorsStop();
break;
}
|____________________________________________________________________________|| |
char danceScript[] = "S1F2R1B1L1\0";
int currentScript = 0; // what step are we at
int currentSong = 0; // keep track of the current song
static const int SONGS_COUNT = 1; // number of songs
char musics[][11] = {
"menu.sqm",
};
Robot.text("Muokattu discobotti", 0, 10);
Robot.text("Koodi by J-P Keskinen", 0, 20);
Robot.text("Laita robot lattialle", 0, 30);
void parseCommand(char dir, char duration) {
//convert the scripts to action
switch(dir) {
case 'L':
Robot.turn(-90);
delay(1000);
break;
case 'R':
Robot.turn(90);
delay(1000);
break;
case 'F':
Robot.motorsWrite(150, 150);
delay(1000);
break;
case 'B':
Robot.motorsWrite(150, 150);
delay(1000);
break;
case 'S':
Robot.motorsStop();
break;
}
|____________________________________________________________________________|| |
Ei kommentteja:
Lähetä kommentti