# Skewb Solving Robot

#### NewCuber000

##### Member
1. Sure, infact I am working on a non-cubic puzzle scrambling bot myself (https://github.com/abunickabhi/WCA_allpuzzle_scrambler) Although I have not found to time and money to get started on it. Also, I am learning robotics for past semester, and will do it after the semester ends. Skewb solving bot sounds dope.

2. Speed is obviously the main thing that comes to my mind if this bot is ever to be used in an official WCA comp.
Move count is another aspect and the way the Tnoodle software takes care of this issue, should be noted by you.

3. I think this project is feasible. (although not on the first attempt, maybe the 10th attempt or so)

5. I have seen big cube solving bots, and 3x3 solving bots in the past (Mostly on this forum: http://cubesolvingprograms.freeforums.net/)

6. Yo! (If you have any further doubts or need help, drop a mail to [email protected])
Thanks for the advice, I'll definitely make sure I consider all of everyone's suggestions! and good luck with your project as well, it sounds really interesting!

Also, I've been emailing with turtwig and we've been trying to incorporate his Skewb solver into our project. It should be doable with the right modifications, it's just a matter of getting it to work, and getting his Java code and our Arduino code to collaborate with each other.

#### NewCuber000

##### Member
this is beautiful
Yeah, it turned out pretty nice, although we made 2 adjustments to the model and it's actually a bit smaller and more compact now. I didn't have a huge part in designing the claws, though, that was mostly my other teammates, Matthew Hill and Matthew Kneed-Teed.

We've made a lot of progress since the last time I updated. We're probably over half-way done the supplementary code that will be used with Turtwigs skewb-solving code, and we're going to start building our first prototype this week! I'll start putting out some more pictures this week.

#### NewCuber000

##### Member

Here is a picture of us beginning to build the initial prototype. At least now you can all get a better idea of what's going on. There are 3 servo motors to grip the cube and 3 stepper motors to turn it. It's not perfect, but it should serve it's intended purpose once we work out a few kinks.

I've written the Arduino code that turns the motors based on a given solving algorithm. If anyone's interested I might link the code here sometime. It's pretty basic, it's just a bunch of if statements that if it's given, for example, b, it will execute a series of motor twists that will do some set up moves, turn b, and undo the setup moves. some rotations will require much longer set up moves than others. Then, it just goes through every letter in the solving algorithm.

Unfortunately, I'm having trouble connecting my Arduino program with our colour-reading Python program as well as Turtwig's Javascript Skewb-solving software. It's definitely quite a task. Arduino doesn't make it easy to read in data into the program from your PC. I may have figured out a way to do it though, so we'll see. Of course, I could always input the colours manually, but that's not as fun.

I'm expecting to have SOMETHING that works within the next two weeks, although it will probably still require some user input.

#### Aerma

##### Member

Here is a picture of us beginning to build the initial prototype. At least now you can all get a better idea of what's going on. There are 3 servo motors to grip the cube and 3 stepper motors to turn it. It's not perfect, but it should serve it's intended purpose once we work out a few kinks.

I've written the Arduino code that turns the motors based on a given solving algorithm. If anyone's interested I might link the code here sometime. It's pretty basic, it's just a bunch of if statements that if it's given, for example, b, it will execute a series of motor twists that will do some set up moves, turn b, and undo the setup moves. some rotations will require much longer set up moves than others. Then, it just goes through every letter in the solving algorithm.

Unfortunately, I'm having trouble connecting my Arduino program with our colour-reading Python program as well as Turtwig's Javascript Skewb-solving software. It's definitely quite a task. Arduino doesn't make it easy to read in data into the program from your PC. I may have figured out a way to do it though, so we'll see. Of course, I could always input the colours manually, but that's not as fun.

I'm expecting to have SOMETHING that works within the next two weeks, although it will probably still require some user input.
That's really cool, good job! I'd love to see the code.

#### NewCuber000

##### Member
That's really cool, good job! I'd love to see the code.
Cool, view the spoiler at your own risk, it's over 400 lines

So the code is kind of unfinished and is extremely inefficient right now. I have 12 different sub-functions being called into my main function, 'setup()', that all correspond to a different set of motor rotations, and I used them as sort of building blocks in my code. I could probably reduce it to about 5 functions if I was smarter about it. I might change it sometime.

The 'Reading in the string' section is unfinished and I just put in something for now that allows me to test the code.

C:
// Skewb-bot Motor Controlling Program
// Eric Boudreau
// This program will take in a string of Skewb notation from a Python program, and will turn all of the motors of the Skewb-bot according to the inputted Skewb notation.

// include the Servo library
#include <Servo.h>

// define pin numbers for Stepper motors
const int dirPin1 = 0;
const int stepPin1 = 1; // stepper 1 for the bottom claw
const int dirPin2 = 2;
const int stepPin2 = 3; // stepper 2 for the left claw (Camera-facing)
const int dirPin3 = 4;
const int stepPin3 = 5; // stepper 3 for the right claw (Camera-facing)

// define constants
int N = 11; // max amount of twists to solve a skewb in given Javascript notation
int x; // Used as a counting variable in for loops.
char incomingString;

// Define servos
Servo servo1; // servo 1 for the bottom claw
Servo servo2; // servo 2 for the left claw
Servo servo3; // servo 3 for the right claw

//******************************************************************************************** Setting Up  ****************************************************************************************************//

// main function, runs once
void setup() {

Serial.begin(9600);

// set all pins as outputs
pinMode(dirPin1 ,OUTPUT);
pinMode(stepPin1 ,OUTPUT);
pinMode(dirPin2 ,OUTPUT);
pinMode(stepPin2 ,OUTPUT);
pinMode(dirPin3 ,OUTPUT);
pinMode(stepPin3 ,OUTPUT);

//Define pins for servos and min and max pulse widths based on servo specifications
servo1.attach(6, 771, 2740);
servo2.attach(7, 771, 2740);
servo3.attach(8, 771, 2740);

//define variables.
char notation[N], front[5], back[5], top[5], left[5], right[5], bottom[5], letter;
int k=0;

//************************************************************************************** Reading in the Colors ************************************************************************************************//

// Turn the cube such that the camera can take a picture of each side of the cube. Print a statement to the serial monitor for every image taken.

rotateBottomCounterclockwise(45);
Serial.print("Take Picture of front side\n");
delay(1000);

rotateBottomClockwise(180);
Serial.print("Take Picture of back side\n");
delay(1000);

rotateBottomClockwise(45);
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); //RESET
rotateBottomCounterclockwise(45);
Serial.print("Take Picture of bottom side\n");
delay(1000);

rotateBottomCounterclockwise(180);
Serial.print("Take Picture of top side\n");
delay(1000);

rotateBottomClockwise(45);
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); //RESET
rotateBottomCounterclockwise(45);
Serial.print("Take Picture of left side\n");
delay(1000);

rotateBottomClockwise(180);
Serial.print("Take Picture of right side\n");
delay(1000);

// reset cube to initial position
rotateBottomCounterclockwise(135);
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); //RESET

notation[0] = 'B';
notation[1] = 'b';
notation[2] = 'U';
notation[3] = 'u';
notation[4] = 'L';
notation[5] = 'l';
notation[6] = 'R';
notation[7] = 'r';

Send arrays to File

//*********************************************************************************************Solving the Cube************************************************************************************************//

//Run the while loop until the end of the string is reached. Cube will go from unscrambled to solved.
while(k<N)
{
letter = notation[k];

if(letter == 'B'){
Serial.print("Turn back clockwise\n");
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnRightClockwise();
ungripAndHold();
turnRightCounterclockwise();
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'b'){
Serial.print("Turn back counterclockwise\n");
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnRightCounterclockwise();
ungripAndHold();
turnRightClockwise();
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); //RESET

}

if(letter == 'U'){
Serial.print("Turn top clockwise\n");
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftClockwise();
ungripAndHold();
turnLeftCounterclockwise(); // RESET
rotateBottomClockwise(90);
}

if(letter == 'u'){
Serial.print("Turn top counterclockwise\n");
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftCounterclockwise();
ungripAndHold();
turnLeftClockwise(); // RESET
rotateBottomClockwise(90);

}

if(letter == 'L'){
Serial.print("Turn left clockwise\n");
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftClockwise();
ungripAndHold();
turnLeftCounterclockwise(); // RESET
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'l'){
Serial.print("Turn left counterclockwise\n");
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftCounterclockwise();
ungripAndHold();
turnLeftClockwise(); // RESET
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'R'){
Serial.print("Turn right clockwise\n");
gripAndRelease();
turnRightClockwise();
ungripAndHold();
turnRightCounterclockwise();
}

if(letter == 'r'){
Serial.print("Turn right counterclockwise\n");
gripAndRelease();
turnRightCounterclockwise();
ungripAndHold();
turnRightClockwise();
}

k++;
}

Serial.print("The Skewb is Solved!\n");
return;

}

void loop(){
return;
}

//************************************************************************************Functions used within the main Program***********************************************************************************//
// rotates cube 90 degrees with bottom plate
void rotateBottomClockwise(int angle){
float fraction;
int steps;
digitalWrite(dirPin1, HIGH);

fraction = angle/360;
steps = fraction*200;

for(x=0; x<steps; x++){
digitalWrite(stepPin1, HIGH);
delay(2);
digitalWrite(stepPin1, LOW);
delay(2);
}
delay(500);
}

void rotateBottomCounterclockwise(int angle){
float fraction;
int steps;
digitalWrite(dirPin1, LOW);

fraction = angle/360;
steps = fraction*200;

for(x=0; x<steps; x++){
digitalWrite(stepPin1, HIGH);
delay(2);
digitalWrite(stepPin1, LOW);
delay(2);
}
delay(500);
}

// side arms grip, and bottom arm releases cube.
void gripAndRelease(){
servo2.write(30);
servo3.write(30);
delay(500);
servo2.write(80);
servo3.write(80);
delay(500);

servo1.write(30);
delay(500);
}

// side arms release, and bottom arm grips cube.
void ungripAndHold(){
servo2.write(80);
servo3.write(80);
delay(500);
servo2.write(30);
servo3.write(30);
delay(500);

servo1.write(80);
}

//does a cube 'flip' backward.
void flipCubeBackward(){
digitalWrite(dirPin2, HIGH);
digitalWrite(dirPin3, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

//does a cube 'flip' forward.
void flipCubeForward(){
digitalWrite(dirPin2, LOW);
digitalWrite(stepPin3, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

void reset180Backward(){
digitalWrite(dirPin2, HIGH);
digitalWrite(dirPin3, LOW);

for(x=0; x<180; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

void reset180Forward(){
digitalWrite(dirPin2, LOW);
digitalWrite(stepPin3, HIGH);

for(x=0; x<180; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

// turns the left corner clockwise.
void turnLeftClockwise(){
digitalWrite(dirPin2, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
delay(2);
}
}

// turns the left corner counterclockwise.
void turnLeftCounterclockwise(){
digitalWrite(dirPin2, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
delay(2);
}
}

// turns the right corner clockwise.
void turnRightClockwise(){
digitalWrite(dirPin3, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

// turns the right corner counterclockwise.
void turnRightCounterclockwise(){
digitalWrite(dirPin3, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin3, LOW);
delay(2);
}
}
[/SPOILER]

// NOTES:
// The code assumes that the cube is in the correct position initially.

#### Aerma

##### Member
Cool, view the spoiler at your own risk, it's over 400 lines

So the code is kind of unfinished and is extremely inefficient right now. I have 12 different sub-functions being called into my main function, 'setup()', that all correspond to a different set of motor rotations, and I used them as sort of building blocks in my code. I could probably reduce it to about 5 functions if I was smarter about it. I might change it sometime.

The 'Reading in the string' section is unfinished and I just put in something for now that allows me to test the code.

C:
// Skewb-bot Motor Controlling Program
// Eric Boudreau
// This program will take in a string of Skewb notation from a Python program, and will turn all of the motors of the Skewb-bot according to the inputted Skewb notation.

// include the Servo library
#include <Servo.h>

// define pin numbers for Stepper motors
const int dirPin1 = 0;
const int stepPin1 = 1; // stepper 1 for the bottom claw
const int dirPin2 = 2;
const int stepPin2 = 3; // stepper 2 for the left claw (Camera-facing)
const int dirPin3 = 4;
const int stepPin3 = 5; // stepper 3 for the right claw (Camera-facing)

// define constants
int N = 11; // max amount of twists to solve a skewb in given Javascript notation
int x; // Used as a counting variable in for loops.
char incomingString;

// Define servos
Servo servo1; // servo 1 for the bottom claw
Servo servo2; // servo 2 for the left claw
Servo servo3; // servo 3 for the right claw

//******************************************************************************************** Setting Up  ****************************************************************************************************//

// main function, runs once
void setup() {

Serial.begin(9600);

// set all pins as outputs
pinMode(dirPin1 ,OUTPUT);
pinMode(stepPin1 ,OUTPUT);
pinMode(dirPin2 ,OUTPUT);
pinMode(stepPin2 ,OUTPUT);
pinMode(dirPin3 ,OUTPUT);
pinMode(stepPin3 ,OUTPUT);

//Define pins for servos and min and max pulse widths based on servo specifications
servo1.attach(6, 771, 2740);
servo2.attach(7, 771, 2740);
servo3.attach(8, 771, 2740);

//define variables.
char notation[N], front[5], back[5], top[5], left[5], right[5], bottom[5], letter;
int k=0;

//************************************************************************************** Reading in the Colors ************************************************************************************************//

// Turn the cube such that the camera can take a picture of each side of the cube. Print a statement to the serial monitor for every image taken.

rotateBottomCounterclockwise(45);
Serial.print("Take Picture of front side\n");
delay(1000);

rotateBottomClockwise(180);
Serial.print("Take Picture of back side\n");
delay(1000);

rotateBottomClockwise(45);
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); //RESET
rotateBottomCounterclockwise(45);
Serial.print("Take Picture of bottom side\n");
delay(1000);

rotateBottomCounterclockwise(180);
Serial.print("Take Picture of top side\n");
delay(1000);

rotateBottomClockwise(45);
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); //RESET
rotateBottomCounterclockwise(45);
Serial.print("Take Picture of left side\n");
delay(1000);

rotateBottomClockwise(180);
Serial.print("Take Picture of right side\n");
delay(1000);

// reset cube to initial position
rotateBottomCounterclockwise(135);
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); //RESET

notation[0] = 'B';
notation[1] = 'b';
notation[2] = 'U';
notation[3] = 'u';
notation[4] = 'L';
notation[5] = 'l';
notation[6] = 'R';
notation[7] = 'r';

Send arrays to File

//*********************************************************************************************Solving the Cube************************************************************************************************//

//Run the while loop until the end of the string is reached. Cube will go from unscrambled to solved.
while(k<N)
{
letter = notation[k];

if(letter == 'B'){
Serial.print("Turn back clockwise\n");
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnRightClockwise();
ungripAndHold();
turnRightCounterclockwise();
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'b'){
Serial.print("Turn back counterclockwise\n");
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnRightCounterclockwise();
ungripAndHold();
turnRightClockwise();
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); //RESET

}

if(letter == 'U'){
Serial.print("Turn top clockwise\n");
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftClockwise();
ungripAndHold();
turnLeftCounterclockwise(); // RESET
rotateBottomClockwise(90);
}

if(letter == 'u'){
Serial.print("Turn top counterclockwise\n");
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftCounterclockwise();
ungripAndHold();
turnLeftClockwise(); // RESET
rotateBottomClockwise(90);

}

if(letter == 'L'){
Serial.print("Turn left clockwise\n");
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftClockwise();
ungripAndHold();
turnLeftCounterclockwise(); // RESET
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'l'){
Serial.print("Turn left counterclockwise\n");
gripAndRelease();
flipCubeForward();
ungripAndHold();
flipCubeBackward(); // RESET
rotateBottomCounterclockwise(90);
reset180Forward(); // RESET
gripAndRelease();
turnLeftCounterclockwise();
ungripAndHold();
turnLeftClockwise(); // RESET
rotateBottomClockwise(90);
reset180Backward(); // RESET
gripAndRelease();
flipCubeBackward();
ungripAndHold();
flipCubeForward(); // RESET
}

if(letter == 'R'){
Serial.print("Turn right clockwise\n");
gripAndRelease();
turnRightClockwise();
ungripAndHold();
turnRightCounterclockwise();
}

if(letter == 'r'){
Serial.print("Turn right counterclockwise\n");
gripAndRelease();
turnRightCounterclockwise();
ungripAndHold();
turnRightClockwise();
}

k++;
}

Serial.print("The Skewb is Solved!\n");
return;

}

void loop(){
return;
}

//************************************************************************************Functions used within the main Program***********************************************************************************//
// rotates cube 90 degrees with bottom plate
void rotateBottomClockwise(int angle){
float fraction;
int steps;
digitalWrite(dirPin1, HIGH);

fraction = angle/360;
steps = fraction*200;

for(x=0; x<steps; x++){
digitalWrite(stepPin1, HIGH);
delay(2);
digitalWrite(stepPin1, LOW);
delay(2);
}
delay(500);
}

void rotateBottomCounterclockwise(int angle){
float fraction;
int steps;
digitalWrite(dirPin1, LOW);

fraction = angle/360;
steps = fraction*200;

for(x=0; x<steps; x++){
digitalWrite(stepPin1, HIGH);
delay(2);
digitalWrite(stepPin1, LOW);
delay(2);
}
delay(500);
}

// side arms grip, and bottom arm releases cube.
void gripAndRelease(){
servo2.write(30);
servo3.write(30);
delay(500);
servo2.write(80);
servo3.write(80);
delay(500);

servo1.write(30);
delay(500);
}

// side arms release, and bottom arm grips cube.
void ungripAndHold(){
servo2.write(80);
servo3.write(80);
delay(500);
servo2.write(30);
servo3.write(30);
delay(500);

servo1.write(80);
}

//does a cube 'flip' backward.
void flipCubeBackward(){
digitalWrite(dirPin2, HIGH);
digitalWrite(dirPin3, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

//does a cube 'flip' forward.
void flipCubeForward(){
digitalWrite(dirPin2, LOW);
digitalWrite(stepPin3, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

void reset180Backward(){
digitalWrite(dirPin2, HIGH);
digitalWrite(dirPin3, LOW);

for(x=0; x<180; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

void reset180Forward(){
digitalWrite(dirPin2, LOW);
digitalWrite(stepPin3, HIGH);

for(x=0; x<180; x++){
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

// turns the left corner clockwise.
void turnLeftClockwise(){
digitalWrite(dirPin2, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
delay(2);
}
}

// turns the left corner counterclockwise.
void turnLeftCounterclockwise(){
digitalWrite(dirPin2, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin2, HIGH);
delay(2);
digitalWrite(stepPin2, LOW);
delay(2);
}
}

// turns the right corner clockwise.
void turnRightClockwise(){
digitalWrite(dirPin3, LOW);

for(x=0; x<67; x++){
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin3, LOW);
delay(2);
}
}

// turns the right corner counterclockwise.
void turnRightCounterclockwise(){
digitalWrite(dirPin3, HIGH);

for(x=0; x<67; x++){
digitalWrite(stepPin3, HIGH);
delay(2);
digitalWrite(stepPin3, LOW);
delay(2);
}
}
[/SPOILER]

// NOTES:
// The code assumes that the cube is in the correct position initially.
This is super cool! How are you planning on going about the solution-finding process?

#### NewCuber000

##### Member
This is super cool! How are you planning on going about the solution-finding process?
We're actually using a Javascript solving program and HTML file given by another user on this site, Turtwig. For now, we can input the colors into his website and get a solving algorithm that we can manually input into the Arduino program. Eventually, though, we would like to use a Python program and a camera to read in the colours by analyzing pixel values in pictures, and use it to connect the Arduino and Javascript programs in a way that all of the programs communicate with each other. Not an easy task, which is why we're taking the slightly easier route first

Also there was quite a few bugs in my Arduino code when I tested it, but we're working on fixing them.

#### NewCuber000

##### Member
So the Arduino code is like 95% functional now (besides a few angles that may have to be adjusted a bit), our only problem is that when we started soldering wires together and used the PCB we made, only half of the motors worked. maybe we just did a poor soldering job, or there are some loose connections, we are newbies after all. Hopefully, we will get it working within the next 2 weeks, and if we do, I'll post a video here.

#### NewCuber000

##### Member
ANOTHER UPDATE: It works... we fixed a couple of soldering connections on the PCB, and now it works great (with a few slight misalignments here in there). We still can't quite get the camera to read in the colours of the cube yet, so for now, I'm doing it manually. But we tried a couple of test scrambles, and it is capable of solving the puzzle.

IT WORKS

I'll post a video in a week or two once it's fully put together and assembled.