Educational toy

Hi everybody i need help about my project. A programmable toy that is fun and educational to play with will be designed and constructed. The toy will contain a number of (e.g. eight) physical barrels each able to take on values 0 to 9 similar to the barrels on a combination lock: https://upload.wikimedia.org/wikipedia/commons/9/99/Combination_discs.png

The values on the barrels will be manipulated by the user via a software application. The programming language should be as simple as possible and designed specifically for the toy consisting of a small number of instructions enough to perform basic tasks; such as "set(barrel_number,barrel_value)", "increase(barrel_number)", "decrease(barrel_number)", "swap(barrel_number_1,barrel_number_2)", ;...
The programming language should support repetitive and conditional structures to allow the user to, for example, implement a sorting algorithm. As a result this is our project so is it possible to do this with Arduino and how should we follow the path? Can you share your experiences?

What have you done so far? Most Arduino projects are done in C, which can do what you're asking.

Actually we do not anything we just purchased tools like arduino mega , breadboard wifi module stepper motors and its drivers and cables. We do not have any idea about arduino codes part :frowning: Because on the youtube we could not find anything about this or similar projects.

toy for what age kids?

Is the code that the user of the toy will write to be entered into the Arduino? I would be more inclined to do the coding on a PC and send it to the toy, but that makes it less portable.

gcjr:
toy for what age kids?
5-10 we want to do very basic toy.

wildbill:
Is the code that the user of the toy will write to be entered into the Arduino? I would be more inclined to do the coding on a PC and send it to the toy, but that makes it less portable.

our lecturer said that software part belong to computer engineer's without arduino part, toy design and arduino code part belong Electrical Electronics students so we have hardware and software part. We need to combine both arduino and hardware part for example i am a user i select 4rt motor and increase 0 to 4 so arduino will understand and running motors. how we can do that?

It kind of sounds like you want the members of this forum to do your homework and write the code for you. Is that correct?

econjack:
It kind of sounds like you want the members of this forum to do your homework and write the code for you. Is that correct?

Actually i want to make sure that can we built is this project on arduino 8 motors selected one by one and take inputs accourding to inputs running motors? stepper motors can rotate with spesific angles and angles represent with numbers like 35 degree = 2 50 degree = 3 is it possible to write code.

can i improve for 6 motors ? my codes are here :

 #include <Stepper.h>
int Bin1Pin = 8;
int Bin2Pin = 7;
int Bin3Pin = 6;
int Bin4Pin = 5;
int R=0;
Stepper motorB(400, Bin1Pin, Bin2Pin, Bin3Pin, Bin4Pin;
void setup()
{

pinMode (Bin1Pin, OUTPUT);
pinMode (Bin2Pin, OUTPUT);
pinMode (Bin3Pin, OUTPUT);
pinMode (Bin4Pin, OUTPUT);

while (!Serial);
Serial.begin(9600);
motorB.setSpeed(20);
Serial.println("STEP MOTOR KONTROL MENU");
}
void loop()
{
if (Serial.available())
}
int Bsteps = Serial.parseInt();
int Bdsteps=(Bdsteps/1.8);
motorB.step(Bdsteps);
Serial.print("R:+");
Serial.print(Bsteps);
Serial.print("      R = ");
R=(R+Bsteps);
Serial.println(R);
Serial.println("* ");
}
}

Guys i have 6 motors and these motors running according to taken codes like 4,30 are taken from user and 4 is represents motor number 30 represens motor's degree for example 0-30 degree moves. So my codes like this but this code only for 1 motor and i am using serial monitör if i enter 90 degree so motor is running up to 90 degree so how can i improve for 6 motors ?

how can i improve for 6 motors ?

Do some research on arrays. Using them will allow code for 1 motor to be used for multiple motors without the code being repeated

Also, your user input will need to include an identifier for which motor the data relates to. Take a look at Serial input basics - updated for techniques for receiving and parsing serial data

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

ufukxtr:
Actually i want to make sure that can we built is this project on arduino 8 motors selected one by one and take inputs accourding to inputs running motors? stepper motors can rotate with spesific angles and angles represent with numbers like 35 degree = 2 50 degree = 3 is it possible to write code.

of course it is

but is your concern more about control of the motors or input of a command to control a particular motor?

gcjr:
of course it is

but is your concern more about control of the motors or input of a command to control a particular motor?

Probably we will do only one motor then we need to use 6 motors to control according to selected inputs. As i mentioned before if i choose motor 4 then motor 4 running 50 steps or if i choose motor 3 and running 60 steps how can i control more motors according to taken values.

Hi ufukxtr,

english seems not your native language. So I suggest that you use google-translate.
Write your postings in your native language and and then use google translate.
Your english is very hard to understand because you write it too broken.

best regards Stefan

StefanL38:
Hi ufukxtr,

english seems not your native language. So I suggest that you use google-translate.
Write your postings in your native language and and then use google translate.
Your english is very hard to understand because you write it too broken.

best regards Stefan

thanks for the feedback

// Arduino stepper motor control code

#include <Stepper.h> // Include the header file

// change this to the number of steps on your motor
#define STEPS 32

// create an instance of the stepper class using the steps and pins
Stepper stepper(STEPS, 8, 10, 9, 11);

int val = 0;

void setup() {
  Serial.begin(9600);
  stepper.setSpeed(200);
}

void loop() {

  if (Serial.available()>0)
  {
    val = Serial.parseInt();
    stepper.step(val);
    Serial.println(val); //for debugging
  }
 

}

**I added the codes I wrote in the attachment, as it can be understood from the codes, we completed it for a single engine, but we can move the single engine from the serial screen.We want to manupilate 6 motors .For example, I chose the 4th motor and I want not to add the 30 steps forward command for the 4th motor or I chose the 5th motor I want to say go 50 steps. **

Your kownledge-level is pretty low.
To be very clear: it is not just writing three lines of code. It is much more.

It is your job to make a first try of programming it.
asking

**We want to manupilate 6 motors .For example, I chose the 4th motor and I want not to add the 30 steps forward command for the 4th motor or I chose the 5th motor I want to say go 50 steps. **

These sentences are hard to understand.
Writing these sentences is a hidden way of asking "can somebody write the code for me"
It is very unlikely that someone will write the code entirely for you
The best way to ask questions in this forum is to have a first selfwritten attempt of trying it and then asking a concrete question.
best regards Stefan