Cubetto project gave me inspiration for my project.
My project is a game that makes children learn programming and learn problem-solving in an easy way.
Also, it makes them identify the difference between directions and shapes.
Also, it can be controlled by an android device
I started by adjusting the dimensions on a paper then I drew each face on fusion 360 to be parts that can be cut using laser cutting machine the I extruded each side and assempelled them together
I started by design parts that I can install components on it like the battery and the breadboard holder
I designed a part to be 3d printed it has the directions on it also it has places for jumpers to put the wires that will allow closing the circuit and then I made a place for it on the face
I also added all the components from grabcad and drew holes for than that I can install them and fix them to the design
i also drew a T joint to install the dc motor on it
also I drew holes for leds, push buttons and the screws and nuts
and designed the head to be like wall e's face as could I see and drew two circles on it to fit the ultrasonic sensor
I saved the faces of the design as dxf files then opened them on laser works to make the parts ready for cutting
MATERIAL; PLY wood 3mm
Then i saved the files as ai files then uploaded it to the laser cutting machine and started cutting
I uoloaded the files that I want to print as stl files from FUSION 360 then I adjusted them on UltiMaker cura to make them ready for printing
MATERIAL : PLA
THEN I exported the files from ultimaker cura as g code then to an sd card then uploades them to the 3d printer
PRUSA I3 MK3
Then I assembeled the parts together
Using fritzing
I started by adjusting the lcd, push buttons and leds withthe arduino
Then I made the wiring diagram of dc motor and l298nand the battery
pins 0/1 are connected to Bluetooth Module
pins 2/3 are connected to the leds
pins 4/5 are connected to the pushbuttons
pins 6/7/8/9 are connected with the inputs of l289n
pins 10/11/A2/A3 are connected with the jumpers
pin 13 is connected to the ultrasonic sensor trig
pin 12 is connected to the ultrasonic sensor echo
pins A5/A4 are connected to the LCD
Ultrasonic sensor HC-SRO4
that will make the project changes its directions when it reads distance less than 20 cm
PUSHBUTTONS
that will make the project start moving
that will be connected to the controller and when the circuited closed it will take orders to move in the chosen directions
That will take the orders from the Android device to make the project move inn different directions.
They will allow the project to move
It will print the value of the randomizer and print a triangle or a square to make the user able to choose the right push button
That will identify if we chose the right shape or not
That will allow us to make dc motors work and making them able to change directions
It is the brain of the project that allows us to control the device
Breadboard half
jumpers
resistors for LEDs and bluetooth module
DC Motor wheel an a caster wheel to make the project able to move
As a power supply I used a High Discharge Lithium Polymer Battery 1000 mAh it gives the power to all the project
its able to be recharged and we know when it must be recharged through the battery tester
I connected it with a switch allows me to turn on or off the project
It gives power to the motor driver to make dc motors work also it gin=ves power to arduino through v in pin that gives the power to the other components
I wrote the code step by step
Firstly, I wanted to create a randomizer that prints its value on the LCD screen
And if the value of the randomizer is a double number it will to an action else it will do another action
So I searched about how to make a randomizer and I wrote this code
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define red 3
#define yellow 2
#define SWITCH1 4
#define SWITCH2 5
long randNumber;
void setup() {
lcd.init();
lcd.backlight();
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(SWTCH1, INPUT);
pinMode(SWTCH2, INPUT);
randomSeed(analogRead(0));
randNumber = random(10);
lcd.clear();
lcd.setCursor(2, 1);
lcd.print(randNumber);
}
void loop() {
if (randNumber == (2)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else if (randNumber == (4)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else if (randNumber == (6)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else if (randNumber == (8)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else if (randNumber == (10)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else if (randNumber == (0)){
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, HIGH);
}
}
Then I worked on the dc motors and the directions codes
int x = 0;
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define red 3
#define yellow 2
long randNumber;
void setup() {
lcd.init();
lcd.backlight();
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
randomSeed(analogRead(0));
randNumber = random(100);
lcd.clear();
lcd.setCursor(2, 1);
lcd.print(randNumber);
}
void loop() {
x = randNumber % 2;
if (x == 0) {
if (digitalRead(4) == HIGH&& digitalRead(5) == LOW) {
digitalWrite(red, HIGH);
digitalWrite(yellow, HIGH);
}
else if (digitalRead(4) == HIGH && digitalRead(5) == HIGH) {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
}
}
else if ( digitalRead(5) == HIGH&& digitalRead(4) == LOW) {
digitalWrite(red, HIGH);
digitalWrite(yellow, HIGH);
}
else if (digitalRead(4) == HIGH && digitalRead(5) == HIGH) {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
}
}
Then I searched about functions and how to write a code using functions and i wrote that code with the help of that link
https://create.arduino.cc/projecthub/shubhamsuresh/how-to-make-a-bluetooth-controlled-rc-car-at-home-521212
int x = 0;
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define red 3
#define yellow 2
byte customChar1[8] = {
0b00000,
0b00000,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b00000
};
byte customChar2[8] = {
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b00000,
0b00000,
0b00000
};
long randNumber;
void setup() {
lcd.init();
lcd.backlight();
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
lcd.createChar(1, customChar1);
lcd.createChar(2, customChar2);
randomSeed(analogRead(0));
randNumber = random(100);
lcd.clear();
lcd.setCursor(2, 1);
lcd.print(randNumber);
}
void loop() {
x = randNumber % 2;
if (x == 0) {
lcd.setCursor(2, 0);
lcd.write((byte)1);
if (digitalRead(4) == HIGH && digitalRead(5) == LOW) {
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
if (digitalRead(A2) == LOW) {
ForWard();
}
else if (digitalRead(A3) == LOW) {
BackWard();
}
else if (digitalRead(10) == LOW) {
Left();
}
else if (digitalRead(11) == LOW) {
Right();
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(3000);
Right();
delay(3000);
BackWard();
delay(3000);
Left();
}
else {
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
else {
lcd.setCursor(2, 0);
lcd.write((byte)2);
if ( digitalRead(5) == HIGH && digitalRead(4) == LOW) {
digitalWrite(red, LOW);
digitalWrite(yellow, HIGH);
if (digitalRead(A2) == LOW) {
ForWard();
}
else if (digitalRead(A3) == LOW) {
BackWard();
}
else if (digitalRead(10) == LOW) {
Left();
}
else if (digitalRead(11) == LOW) {
Right();
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(3000);
Right();
delay(3000);
BackWard();
delay(3000);
Left();
}
else {
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
}
void ForWard()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void BackWard()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void Left()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void Right()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void sTOP()
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
Then I added the ultrasonic sensor an wrote its code
int x = 0;
int trig = 13;
int echo = 12;
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define red 3
#define yellow 2
byte customChar1[8] = {
0b00000,
0b00000,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b00000
};
byte customChar2[8] = {
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b00000,
0b00000,
0b00000
};
long randNumber;
void setup() {
lcd.init();
lcd.backlight();
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
lcd.createChar(1, customChar1);
lcd.createChar(2, customChar2);
randomSeed(analogRead(0));
randNumber = random(100);
lcd.clear();
lcd.setCursor(2, 1);
lcd.print(randNumber);
}
void loop() {
long t, f;
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
t = pulseIn(echo, HIGH);
f = t / 29 / 2;
// Serial.println(f);
//delay(50);
x = randNumber % 2;
if (x == 0) {
lcd.setCursor(2, 0);
lcd.write((byte)1);
if (digitalRead(4) == HIGH && digitalRead(5) == LOW) {
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
if (f > 20){
if (digitalRead(A2) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(11) == HIGH) {
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(A3) == LOW && digitalRead(10) == HIGH && digitalRead(11) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(10) == LOW && digitalRead(11) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(500);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
}
else {
sTOP();
}
}
else {
BackWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
else {
lcd.setCursor(2, 0);
lcd.write((byte)2);
if (digitalRead(4) == LOW && digitalRead(5) == HIGH) {
digitalWrite(red, LOW);
digitalWrite(yellow, HIGH);
if (f > 20){
if (digitalRead(A2) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(11) == HIGH) {
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(A3) == LOW && digitalRead(10) == HIGH && digitalRead(11) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(10) == LOW && digitalRead(11) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(500);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
sTOP();
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
}
else {
sTOP();
}
}
else {
BackWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
}
void ForWard()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void BackWard()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void Left()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void Right()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void sTOP()
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
Finally, I wrote the code of theBluetooth module controller and finally the code is done
and that code explanation is
if the user choose the shape that is printed on the screen and adjusted the directions in the controller move in to these directions and if you get neer to a body in a distance less than 20 cm change your directions and if you get orders from an android follow it
so I used in this cond remainder and a randomizer
b int x = 0;
int trig = 13;
int echo = 12;
char incomingData = '0';
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define red 3
#define yellow 2
byte customChar1[8] = {
0b00000,
0b00000,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b00000
};
byte customChar2[8] = {
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b00000,
0b00000,
0b00000
};
long randNumber;
char d = 0;
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
lcd.createChar(1, customChar1);
lcd.createChar(2, customChar2);
randomSeed(analogRead(0));
randNumber = random(100);
lcd.clear();
lcd.setCursor(2, 1);
lcd.print(randNumber);
}
void loop() {
if (Serial.available() > 0)
{
d = Serial.read();
if (d == 'F')
{
ForWard();
}
if (d == 'B')
{
BackWard();
}
if (d == 'L')
{
Left();
}
if (d == 'R')
{
Right();
}
if (d == 'S')
{
sTOP();
}
}
else {
long t, f;
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
t = pulseIn(echo, HIGH);
f = t / 29 / 2;
// Serial.println(f);
//delay(50);
x = randNumber % 2;
if (x == 0) {
lcd.setCursor(2, 0);
lcd.write((byte)1);
if (digitalRead(4) == HIGH && digitalRead(5) == LOW) {
digitalWrite(red, HIGH);
digitalWrite(yellow, LOW);
if (f > 20) {
if (digitalRead(A2) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(11) == HIGH) {
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else if (digitalRead(A3) == LOW && digitalRead(10) == HIGH && digitalRead(11) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Right();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(10) == LOW && digitalRead(11) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Left();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == HIGH && digitalRead(10) == HIGH && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else {
sTOP();
}
}
else {
BackWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
else {
lcd.setCursor(2, 0);
lcd.write((byte)2);
if (digitalRead(4) == LOW && digitalRead(5) == HIGH) {
digitalWrite(red, LOW);
digitalWrite(yellow, HIGH);
if (f > 20) {
if (digitalRead(A2) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(11) == HIGH) {
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else if (digitalRead(A3) == LOW && digitalRead(10) == HIGH && digitalRead(11) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Right();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(10) == LOW && digitalRead(11) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == HIGH) {
ForWard();
delay(200);
Left();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == HIGH && digitalRead(10) == HIGH && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == HIGH && digitalRead(A3) == HIGH && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(200);
sTOP();
delay(5000);
}
else if (digitalRead(11) == LOW && digitalRead(10) == LOW && digitalRead(A3) == LOW && digitalRead(A2) == LOW) {
ForWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
Left();
delay(300);
ForWard();
delay(1000);
Right();
delay(700);
ForWard();
delay(1000);
sTOP();
delay(5000);
}
else {
sTOP();
}
}
else {
BackWard();
delay(1000);
Right();
delay(300);
ForWard();
delay(1000);
sTOP();
}
}
else {
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
sTOP();
}
}
}
}
void ForWard()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void BackWard()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void Left()
{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void Right()
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
void sTOP()
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
each part that explained in the coding process i tested it on the circuit to see if it was working well or not
Testing if the controller works or not
Testing the directions and how the project is working
Testing the ultra sonic sensor
Testing the process of controlling the project with mobile app
At first for the controller, I was going to use LDR sensors but the instructor suggested that I should use jumpers and Tinfoil instead and it was a better idea
I didn't know ho to use remainder feature in coding so the instructor helped me in how to search and understand it and he explained how % in coding works.
I helped My teammate Amir with the LCD I helped him in uploading its library and make it work
I have done the fabrication early and faced some problems in installing
components like the Arduino port position was really right so told my teammates to use a different Arduino model on fusion 360
My teammate Amir helped me in assembling my project
I wanted to make sure that the wires= of the controller doesn't fall so Saeed suggested that I can cover it with a piece of wood and the same with the battery tester
In the coding process at first in the dc and the controller code the orders were mixed up and all the circuit wasn't working well and I couldn't find out what the problem was so I turned to the instructor Israa and we tried to figure out together what the problem was and finally thanks to her we found out that should have written INPUT_PULLUP not just INPUT while identifying the switch and the jumpers
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
byte customChar[8] = {
0b00000,
0b00000,
0b10101,
0b01110,
0b11111,
0b01110,
0b10101,
0b00000
};
void setup() {
lcd.init();
lcd.backlight();
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(A3, INPUT);
pinMode(A2, INPUT);
lcd.createChar(0, customChar);
}
void loop() {
if (digitalRead(10) == HIGH ){
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("move forward");
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
else if (digitalRead(11) == HIGH ) {
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
else if (digitalRead(A2) == HIGH ) {
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(10000);
}
else if ( digitalRead(A3) == HIGH) {
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
else {
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
}
}
when I first Wrote the code it was very big it was like more than 950 lines and it was hard for me to edit it so the instructor told me to search how to make functions in the code and the code became smaller
The parts I fabricated to cover the controller it feels hard to fix or install them to and I need to push hard on them to install them and when the project move they fall down so i designed them again an I kind of solved the proplem
I would make the surface of the controller slightly slanted to keep the parts from falling
I would like to add an arm to and making its head moving using servo motors
I would like to add music to it
I would like to make its eyes fading when its turned on
I would like to add more shapes in the randomizer
I would like to learn how to design an app for it