TOP 10 MINIJUEGO con ARDUINO || Proyectos con arduino 2020
Vložit
- čas přidán 2. 09. 2020
- Vídeo con el MONTAJE + EXPLICACION de cada proyecto:
Minijuego 1: • ✅ SNAKE GAME con MATRI...
Minijuego 2: • PIANO con PLÁTANOS || ...
Minijuego 3: • PING-PONG con ARDUINO ...
Minijuego 4: • DIANA para PUNTERIA LA...
Minijuego 5: • MINIJUEGO no toques el...
Minijuego 6: • PROYECTO RADAR con ARD...
Minijuego 7: • MINIJUEGO con ARDUINO ...
Minijuego 8: • MINIJUEGO en PANTALLA ...
Minijuego 9: • HACKEANDO el T-REX de ...
Minijuego 10: • ✅CARRERA DE ENCENDER L...
📢Mi kit de ARDUINO: amzn.to/2FYAw1N
➜COMENTA que te ha parecido y dale a 👍
➜SUSCRIBETE para no perderte ningún vídeo. - Věda a technologie
👇Más Proyectos de Electronica y Arduino👇
www.robotuno.com/
Muy bien vas amigo sigue así vas por buen camino.
Muchas gracias Franco!! Un saludo
Muy guapos tus proyectos voy a hacer mas de uno jeje
Muchas gracias!! : )
Guapísimos lo projectos ...para mí el mejor el radar de ultrasonidos...jeje..me flipo...👌
Muchas gracias!!
una pregunta que carrera estas estudiando o estudiaste? buen vídeo creo que haré el ping pong de leds.
Estoy a punto de acabar ingenieria electronica. Un saludo y si lo haces puedes pasarme un video a mi correo electronico!
4:00 jajsj, ahora de como hacer un directo infinito jsjs
No es mala idea ajjajajaja
hola a mi el del piano con platanos
Tienes los codigos en la descripcion del video! un saludo
Hola, estan buenos tus proyectos, me posrias mandar el minijuego 6, gracias. Saludos
Claro!! de todas formas ese proyecto lo explico en este video mucho mejor czcams.com/video/tDJb5aCa9PQ/video.html
Pero aqui tienes los 2 codigos que se necesitan
//CODIGO ARDUINO
//Canal de YT -> RobotUNO
//Proyecto RADAR
#include
const int trigPin = 10;
const int echoPin = 11;
long duration;
int distance;
Servo myServo;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
myServo.attach(12);
}
void loop() {
for(int i=15;i15;i--){
myServo.write(i);
delay(30);
distance = calculateDistance();
Serial.print(i);
Serial.print(",");
Serial.print(distance);
Serial.print(".");
}
}
int calculateDistance(){
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance= duration*0.034/2;
return distance;
}
import processing.serial.*; // imports library for serial communication
import java.awt.event.KeyEvent; // imports library for reading the data from the serial port
import java.io.IOException;
Serial myPort; // defines Object Serial
// defubes variables
String angle="";
String distance="";
String data="";
String noObject;
float pixsDistance;
int iAngle, iDistance;
int index1=0;
int index2=0;
PFont orcFont;
void setup() {
size (1200, 700); // ***CHANGE THIS TO YOUR SCREEN RESOLUTION***
smooth();
myPort = new Serial(this,"COM7", 9600); // starts the serial communication
myPort.bufferUntil('.'); // reads the data from the serial port up to the character '.'. So actually it reads this: angle,distance.
}
void draw() {
fill(98,245,31);
// simulating motion blur and slow fade of the moving line
noStroke();
fill(0,4);
rect(0, 0, width, height-height*0.065);
fill(98,245,31); // green color
// calls the functions for drawing the radar
drawRadar();
drawLine();
drawObject();
drawText();
}
void serialEvent (Serial myPort) { // starts reading data from the Serial Port
// reads the data from the Serial Port up to the character '.' and puts it into the String variable "data".
data = myPort.readStringUntil('.');
data = data.substring(0,data.length()-1);
index1 = data.indexOf(","); // find the character ',' and puts it into the variable "index1"
angle= data.substring(0, index1); // read the data from position "0" to position of the variable index1 or thats the value of the angle the Arduino Board sent into the Serial Port
distance= data.substring(index1+1, data.length()); // read the data from position "index1" to the end of the data pr thats the value of the distance
// converts the String variables into Integer
iAngle = int(angle);
iDistance = int(distance);
}
void drawRadar() {
pushMatrix();
translate(width/2,height-height*0.074); // moves the starting coordinats to new location
noFill();
strokeWeight(2);
stroke(98,245,31);
// draws the arc lines
arc(0,0,(width-width*0.0625),(width-width*0.0625),PI,TWO_PI);
arc(0,0,(width-width*0.27),(width-width*0.27),PI,TWO_PI);
arc(0,0,(width-width*0.479),(width-width*0.479),PI,TWO_PI);
arc(0,0,(width-width*0.687),(width-width*0.687),PI,TWO_PI);
// draws the angle lines
line(-width/2,0,width/2,0);
line(0,0,(-width/2)*cos(radians(30)),(-width/2)*sin(radians(30)));
line(0,0,(-width/2)*cos(radians(60)),(-width/2)*sin(radians(60)));
line(0,0,(-width/2)*cos(radians(90)),(-width/2)*sin(radians(90)));
line(0,0,(-width/2)*cos(radians(120)),(-width/2)*sin(radians(120)));
line(0,0,(-width/2)*cos(radians(150)),(-width/2)*sin(radians(150)));
line((-width/2)*cos(radians(30)),0,width/2,0);
popMatrix();
}
void drawObject() {
pushMatrix();
translate(width/2,height-height*0.074); // moves the starting coordinats to new location
strokeWeight(9);
stroke(255,10,10); // red color
pixsDistance = iDistance*((height-height*0.1666)*0.025); // covers the distance from the sensor from cm to pixels
// limiting the range to 40 cms
if(iDistance40) {
noObject = "Out of Range";
}
else {
noObject = "In Range";
}
fill(0,0,0);
noStroke();
rect(0, height-height*0.0648, width, height);
fill(98,245,31);
textSize(25);
text("10cm",width-width*0.3854,height-height*0.0833);
text("20cm",width-width*0.281,height-height*0.0833);
text("30cm",width-width*0.177,height-height*0.0833);
text("40cm",width-width*0.0729,height-height*0.0833);
textSize(40);
text("FABRI creator", width-width*0.875, height-height*0.0277);
text("Ángulo: " + iAngle +" °", width-width*0.48, height-height*0.0277);
text("Dist:", width-width*0.26, height-height*0.0277);
if(iDistance
Muchas gracias
Te felicito sigue asi
Hola son unos excelentes juegos
Me pregunto si me podrías pasar el código del juego 1y10 te lo agradecería mucho
Saludos
Claro!!! aqui te los dejo. Pero no te olvides que en la descripción tienes enlaces a todos los proyectos!
//Canal de CZcams -> RobotUNO
//Juego snake en pantalla led 8x8
#include "LedControl.h"
//pins
const int SW_pin = 2;
const int X_pin = 0;
const int Y_pin = 1;
const int DIN = 12;
const int CS = 11;
const int CLK = 10;
const int BUZZER = 8;
//variables
const int screenWidth = 8;
const int screenHeight = 8;
int snakeX, snakeY, foodX, foodY, score = 0, snakeSize = 1;
char direction;
int tailX[100], tailY[100];
bool isGameOver = false;
LedControl lc = LedControl(DIN, CS, CLK, 1);
void setup() {
setupPins();
setupLedBoard();
setupSnakePosition();
setupFoodPosition();
}
void setupSnakePosition() {
snakeX = 4;
snakeY = 4;
}
void setupFoodPosition() {
foodX = rand() % screenWidth;
foodY = rand() % screenHeight;
}
void setupLedBoard() {
lc.shutdown(0, false);
lc.setIntensity(0, 1);
lc.clearDisplay(0);
}
void setupPins() {
pinMode(SW_pin, INPUT);
digitalWrite(SW_pin, HIGH);
}
void loop() {
if (isGameOver) {
playGameOverSong();
showGameOverScreen();
} else {
startGame();
}
}
void playGameOverSong() {
tone(BUZZER, 1000, 1000);
delay(100);
tone(BUZZER, 2000, 1000);
delay(100);
tone(BUZZER, 3000, 1000);
delay(100);
tone(BUZZER, 4000, 1000);
delay(100);
tone(BUZZER, 5000, 2000);
}
void playFoodEatenSong() {
tone(BUZZER, 500, 100);
}
void startGame() {
manageGameOver();
setJoystickDirection();
changeSnakeDirection();
manageSnakeOutOfBounds();
manageEatenFood();
manageSnakeTailCoordinates();
drawSnake();
delay(300);
}
void manageGameOver() {
for (int i = 1; i < snakeSize; i++) {
if (tailX[i] == snakeX && tailY[i] == snakeY) {
isGameOver = true;
}
}
}
void manageSnakeOutOfBounds() {
if (snakeX >= screenWidth) {
snakeX = 0;
} else if (snakeX < 0) {
snakeX = screenWidth - 1;
}
if (snakeY >= screenHeight) {
snakeY = 0;
} else if (snakeY < 0) {
snakeY = screenHeight - 1;
}
}
void manageSnakeTailCoordinates() {
int previousX, previousY, prevX, prevY;
previousX = tailX[0];
previousY = tailY[0];
tailX[0] = snakeX;
tailY[0] = snakeY;
for (int i = 1; i < snakeSize; i++) {
prevX = tailX[i];
prevY = tailY[i];
tailX[i] = previousX;
tailY[i] = previousY;
previousX = prevX;
previousY = prevY;
}
}
void manageEatenFood() {
if (snakeX == foodX && snakeY == foodY) {
playFoodEatenSong();
score++;
snakeSize++;
setupFoodPosition();
}
}
void setJoystickDirection() {
if (analogRead(X_pin) > 1000) {
direction = 'u';
} else if (analogRead(X_pin) < 100) {
direction = 'd';
} else if (analogRead(Y_pin) > 1000) {
direction = 'l';
} else if (analogRead(Y_pin) < 100) {
direction = 'r';
}
}
void changeSnakeDirection() {
switch (direction) {
case 'l':
snakeX--;
break;
case 'r':
snakeX++;
break;
case 'u':
snakeY--;
break;
case 'd':
snakeY++;
break;
}
}
void showGameOverScreen() {
for (int i = 0; i < screenHeight; i++) {
for (int j = 0; j < screenWidth; j++) {
showLed(j, i);
delay(50);
}
}
resetVariables();
}
void resetVariables() {
setupSnakePosition();
setupFoodPosition();
direction = ' ';
isGameOver = false;
score = 0;
snakeSize = 1;
}
void showLed(int row, int column) {
lc.setLed(0, row, column, true);
}
void hideLed(int row, int column) {
lc.setLed(0, row, column, false);
}
void drawSnake() {
for (int i = 0; i < screenHeight; i++) {
for (int j = 0; j < screenWidth; j++) {
if (i == snakeY && j == snakeX) {
showLed(snakeX, snakeY);
} else if (i == foodY && j == foodX) {
showLed(foodX, foodY);
} else {
bool isShown = false;
for (int k = 0; k < snakeSize; k++) {
if (tailX[k] == j && tailY[k] == i) {
showLed(j, i);
isShown = true;
}
}
if (!isShown) {
hideLed(j, i);
}
}
}
}
}
//Canal de CZcams -> RobotUNO
//Carrera con leds
#define button1 8
#define button2 4
#define led1 9
#define led2 5
int goal = 10, win=0, flag1=0, flag2=0;
int state1 = 0;
int state2 = 0;
int contador1 = 0;
int contador2 = 0;
void setup(){
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop(){
state1 = digitalRead(button1);
state2 = digitalRead(button2);
if(state1 == HIGH && flag1==0){
contador1++;
flag1=1;
}
if(state1==LOW && flag1==1){
flag1=0;
}
if(state2==HIGH && flag2==0){
contador2++;
flag2=1;
}
if(state2==LOW && flag2==1){
flag2=0;
}
if(contador1 == goal && win==0){
for(int i=0;i
A por supuesto
Gracias
Hola soy nuevo en el canal ya que tengo un arduino mega 2560 me gustaria hacer proyectos como tu
bienvenido al canal!!! si tienes cualquier duda preguntamela!
@@RobotUNO ahora este es mi canal favorito
Hola, son buenos proyectos esos, me pasas el primero
Claro!!!
//Canal de CZcams -> RobotUNO
//Juego snake en pantalla led 8x8
#include "LedControl.h"
//pins
const int SW_pin = 2;
const int X_pin = 0;
const int Y_pin = 1;
const int DIN = 12;
const int CS = 11;
const int CLK = 10;
const int BUZZER = 8;
//variables
const int screenWidth = 8;
const int screenHeight = 8;
int snakeX, snakeY, foodX, foodY, score = 0, snakeSize = 1;
char direction;
int tailX[100], tailY[100];
bool isGameOver = false;
LedControl lc = LedControl(DIN, CS, CLK, 1);
void setup() {
setupPins();
setupLedBoard();
setupSnakePosition();
setupFoodPosition();
}
void setupSnakePosition() {
snakeX = 4;
snakeY = 4;
}
void setupFoodPosition() {
foodX = rand() % screenWidth;
foodY = rand() % screenHeight;
}
void setupLedBoard() {
lc.shutdown(0, false);
lc.setIntensity(0, 1);
lc.clearDisplay(0);
}
void setupPins() {
pinMode(SW_pin, INPUT);
digitalWrite(SW_pin, HIGH);
}
void loop() {
if (isGameOver) {
playGameOverSong();
showGameOverScreen();
} else {
startGame();
}
}
void playGameOverSong() {
tone(BUZZER, 1000, 1000);
delay(100);
tone(BUZZER, 2000, 1000);
delay(100);
tone(BUZZER, 3000, 1000);
delay(100);
tone(BUZZER, 4000, 1000);
delay(100);
tone(BUZZER, 5000, 2000);
}
void playFoodEatenSong() {
tone(BUZZER, 500, 100);
}
void startGame() {
manageGameOver();
setJoystickDirection();
changeSnakeDirection();
manageSnakeOutOfBounds();
manageEatenFood();
manageSnakeTailCoordinates();
drawSnake();
delay(300);
}
void manageGameOver() {
for (int i = 1; i < snakeSize; i++) {
if (tailX[i] == snakeX && tailY[i] == snakeY) {
isGameOver = true;
}
}
}
void manageSnakeOutOfBounds() {
if (snakeX >= screenWidth) {
snakeX = 0;
} else if (snakeX < 0) {
snakeX = screenWidth - 1;
}
if (snakeY >= screenHeight) {
snakeY = 0;
} else if (snakeY < 0) {
snakeY = screenHeight - 1;
}
}
void manageSnakeTailCoordinates() {
int previousX, previousY, prevX, prevY;
previousX = tailX[0];
previousY = tailY[0];
tailX[0] = snakeX;
tailY[0] = snakeY;
for (int i = 1; i < snakeSize; i++) {
prevX = tailX[i];
prevY = tailY[i];
tailX[i] = previousX;
tailY[i] = previousY;
previousX = prevX;
previousY = prevY;
}
}
void manageEatenFood() {
if (snakeX == foodX && snakeY == foodY) {
playFoodEatenSong();
score++;
snakeSize++;
setupFoodPosition();
}
}
void setJoystickDirection() {
if (analogRead(X_pin) > 1000) {
direction = 'u';
} else if (analogRead(X_pin) < 100) {
direction = 'd';
} else if (analogRead(Y_pin) > 1000) {
direction = 'l';
} else if (analogRead(Y_pin) < 100) {
direction = 'r';
}
}
void changeSnakeDirection() {
switch (direction) {
case 'l':
snakeX--;
break;
case 'r':
snakeX++;
break;
case 'u':
snakeY--;
break;
case 'd':
snakeY++;
break;
}
}
void showGameOverScreen() {
for (int i = 0; i < screenHeight; i++) {
for (int j = 0; j < screenWidth; j++) {
showLed(j, i);
delay(50);
}
}
resetVariables();
}
void resetVariables() {
setupSnakePosition();
setupFoodPosition();
direction = ' ';
isGameOver = false;
score = 0;
snakeSize = 1;
}
void showLed(int row, int column) {
lc.setLed(0, row, column, true);
}
void hideLed(int row, int column) {
lc.setLed(0, row, column, false);
}
void drawSnake() {
for (int i = 0; i < screenHeight; i++) {
for (int j = 0; j < screenWidth; j++) {
if (i == snakeY && j == snakeX) {
showLed(snakeX, snakeY);
} else if (i == foodY && j == foodX) {
showLed(foodX, foodY);
} else {
bool isShown = false;
for (int k = 0; k < snakeSize; k++) {
if (tailX[k] == j && tailY[k] == i) {
showLed(j, i);
isShown = true;
}
}
if (!isShown) {
hideLed(j, i);
}
}
}
}
}
puedes hacer una maquina expendedora con arduino hazlo por mi pls
UYYYYYYYYYYY Muchas gracias por la idea! la verdad es que este mes estoy muy ocupado, pero el mes que viene puede ser que lo haga (tengo que pensar como)
@@RobotUNO ok :3
NO HAY EL VIDEO DE HACER ESE CARGADOR mrd 🗿 encima caro el joystick y ese cargador
Que asco la musica