This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Bienvenido, Invitado
Tienes que registrarte para poder participar en nuestro foro.

Nombre de usuario
  

Contraseña
  





Estadísticas del foro
» Miembros: 18,154
» Último miembro: impact_fiesta
» Temas del foro: 12,438
» Mensajes del foro: 118,954

Estadísticas totales

Últimos temas
¿Qué filamento es el mejo...
Foro: General
Último mensaje por: Simemart
10-02-2026, 11:49 AM
» Respuestas: 1
» Vistas: 85
Reducir purga AD5X.
Foro: General
Último mensaje por: javicf
09-02-2026, 05:58 PM
» Respuestas: 0
» Vistas: 77
fallo de escritura en Uni...
Foro: Firmware y Software
Último mensaje por: Simemart
07-02-2026, 10:09 PM
» Respuestas: 19
» Vistas: 1,225
Contador de series de eje...
Foro: Informática
Último mensaje por: ethanrobinson96
06-02-2026, 04:00 AM
» Respuestas: 2
» Vistas: 868
Impresión nylon con fibra
Foro: General
Último mensaje por: Tonete
03-02-2026, 10:40 AM
» Respuestas: 2
» Vistas: 340
¿Que impresora compro?
Foro: General
Último mensaje por: javicf
20-01-2026, 06:34 PM
» Respuestas: 0
» Vistas: 308





















 
  Novato con Arduino intentando hacer un robotito
Enviado por: malopezn - 24-12-2013, 07:44 PM - Foro: Arduino - Respuestas (4)

Hola,

estoy tratando de aprender Arduino. Voy leyendo y peleandome lo que puedo, pero claro, sin conocimientos previos de programación se hace un poco complicado.

Puse el ojo en este robotito: http://www.thingiverse.com/thing:4133

Pedi piezas y una vez han llegado me he puesto a montarlo. De las piezas que muestra el autor solo valen las ruedas, y para los motores que yo he comprado hay que modificarles el buje. El cuerpo del robot es nefasto, lo he rehecho con una rueda delantera, una cogida para el arduino y unos agarren en condiciones para los motores. Ha quedado muy simpatico, parece un cañón.

Con respecto la sensor de proximidad, el que el autor cita me pareció muy básico y pedí un sonar. Claro, mis ganas van más rápidas que mis posibilidades.

La Motor shield no me deja pines digitales libres y el sonar lleva digitales (SRF05), así que lo he montado sobre los análogicos nombrandolos a partir del 14, y funciona. Hay un modo en el que el sonar hace echo y trigger por el mismo pin pero no he conseguido hacerlo funcionar, estoy haciendolo por pines independientes.

Y ahora, como ando muy verde con el código me encuentro con que tengo el código original del robot hecho para el sensor sharp y por otro lado un código funcional para el sonar. He tratado de fusionarlos en uno pero cero patatero.

Algún gurú me echa un cable?

Gracias!

Cita:/*
  Marvin Mk2 Control Code 
 
  by J. Mark Weller
*/

#include <AFMotor.h>

AF_DCMotor motor1(3, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(4, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

int sensorPin = 0; // select the input pin for the potentiometer
//int ledPin = 13;      // select the pin for the LED
double sensorValue = 0; // variable to store the value coming from the sensor
int iTurnTime = 100; // variable to store the milliseconds of each turn (segment)
int c = 0;

void setup() {
  Serial.begin (115200);
  Serial.println ("Marvin Mk2.01");
   
  motor1.setSpeed(255); // set the speed to 255/255
  motor2.setSpeed(255); // set the speed to 255/255

  // declare the ledPin as an OUTPUT:
  //pinMode(ledPin, OUTPUT);
}

void loop() {
  if (iReadSensor() < 400)
    vMoveFwd();
  else
    vTurnLeft();
}

int iReadSensor() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  if (sensorValue != 0)
   {  
     return sensorValue;
   }
}

void vMoveFwd() {
  motor1.run(FORWARD); // turn it on going forward
  motor2.run(FORWARD); // turn it on going forward
}

void vTurnLeft() {
  motor1.run(BACKWARD); // turn it on going forward
  motor2.run(FORWARD); // turn it on going forward
  delay(iTurnTime);
}

void vStop() {
  motor1.run(RELEASE); // turn it on going forward
  motor2.run(RELEASE); // turn it on going forward
}

Cita:/* HC-SR04 Sensor
https://www.dealextreme.com/p/hc-sr04-ul...ule-133696
This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit:
* VCC connection of the sensor attached to +5V
* GND connection of the sensor attached to ground
* TRIG connection of the sensor attached to digital pin 2
* ECHO connection of the sensor attached to digital pin 4


Original code for Ping))) example was created by David A. Mellis
Adapted for HC-SR04 by Tautvidas Sipavicius

This example code is in the public domain.
*/


const int trigPin = 19;
const int echoPin = 14;

void setup() {
// initialize serial communication:
Serial.begin(9600);
}

void loop()
{
// establish variables for duration of the ping,
// and the distance result in inches and centimeters:
long duration, inches, cm;

// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(trigPin, OUTPUT);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}

long microsecondsToInches(long microseconds)
{
// According to Parallax's datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second). This gives the distance travelled by the ping, outbound
// and return, so we divide by 2 to get the distance of the obstacle.
// See: http://www.parallax.com/dl/docs/prod/acc...G-v1.3.pdf
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}


  Creo que me he cargado las varillas lisas [1ª Conjunta]
Enviado por: jaudo - 24-12-2013, 01:58 AM - Foro: General - Respuestas (13)

Hola buenas, hace unos días terminé el trimestre (Estudio fuera de mi casa) y hasta ahora no he podido ponerme a tope con la prusa. Decir que soy todavía de la conjunta de Ghosthawk, y creo que me he cargado las varillas lisas.

Ademas lo mio es de traca pues abrí un hilo expresamente para preguntar como se tenía que hacer :dale2: :dale2:

Compré una lima de metal, y a parte de limar los extremos de las varillas para que entraran bien... me dió por limar el tronco de las varillas lisas, y creo que he hecho una chapuza bestial, porque no bajan con los rodamientos. No sé porqué pensaba que las varillas había que limarlas enteras :dale2: :dale2: en fin... en el caso de que me las haya cargado, sabéis de algún lugar donde pueda comprar solo las varillas lisas? Iré a la ferreteria y ya está...

Osea he limado a parte de los extremos para que entrara bien el tronco (no sé porque coño pensaba que había que limar el tronco) y ahora parece que deslize peor...

En definitiva; Le paso una lima de metal, las dejo como están o me compro unas nuevas?

No sé si colgando fotos se apreciará, pero básicamente le he pasado una lima de metal por todo el tronco, con lo que la parte lista tiene imperfecciones... (es que lo pienso ahora y :dale2: :dale2: :dale2: no sé como se me pudo ocurrir... en fin...)


  Posible proyecto: ratón con calefacción incorporada
Enviado por: yo_mismo - 23-12-2013, 02:05 PM - Foro: Electrónica - Respuestas (2)

Hola a todos.

Se me ha ocurrido coger un ratón y ponerle unas resistencias dentro, con un interruptor, para hacer un ratón con calefacción incorporada, y regalarselo a un amigo (en plan de broma) para relles, porque se queja que siempre tiene las manos frias.

He visto que con un par de resistencias de 6,8ohm 1w y una placa metálica se podría hacer, pero como mis conocimientos de electronica son nulos, antes de cargarme nada pregunto.

¿Sería factible?


  Duda Sintaxis
Enviado por: Triggerr - 22-12-2013, 11:35 PM - Foro: Arduino - Respuestas (4)

Me da algo de palo abrir un post para preguntar esto jajaja, pero esque no lo veo.

La siguiente linea:

Código:
A_set = digitalRead(encoderPinA) == HIGH;

Asignamos a la variable A_set el valor del pin encoderPinA, y si es HIGH seguimos con la serie de instrucciones?, de no ser HIGH cortamos la ejecucion en esa linea?


  problema al compilar con la libreria LiquidCrystal_I2C
Enviado por: pedro - 21-12-2013, 09:00 PM - Foro: Arduino - Respuestas (16)

Hola, el motivo de esta pregunta es porque estoy realizando un proyecto con el arduino uno y un LCD de16x2; el problema es que yo lo estaba realizando en un ordenador con xp instalado que por motivos profesionales he tenido que dejar, el problema surge cuando al reanudar de nuevo es otros equipos tanto con xp como con W7 instalado me da un fallo al compilar, con exactamente todo igual, las mismas librerías el mismo programa de arduino etc..
El fallo que me da es el siguiente: Incubadora_final_pruebasV4_horas:7:error: `POSITIVE´was not declared in this scope
Y como lo tengo en el programas es como sigue:
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3,POSITIVE);
// Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity
Si hay alguien que me pueda hecar un cable por que ya le pasara o porque sepa cual es el problema se lo agradeceria.
Saludos