elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Temas
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 [14] 15 16 17
131  Foros Generales / Foro Libre / Esto es serio en: 2 Junio 2010, 23:10 pm
últimamente, cada vez que creo un post, se sale de su temática y la gente empieza a "discutir"  :silbar: ¿Por qué mis post son tan polémicos? En serio, ¿Qué pasa? XD
132  Foros Generales / Foro Libre / Hacking en: 2 Junio 2010, 20:31 pm
Hoy discutí con un par de personas sobre qué es un Hacker. Ellos defendían que eran personas que atacan ordenadores, buscan bugs, intentar meterse en redes ajenas, etc.

Y yo he defendido que los Hackers son los que intentan liberar la informática, a base de soft libre, ética, etc.

También quiero incluir que han tachado a R. Stallman de problemático y loco.

¿Alguna opinión?
133  Foros Generales / Foro Libre / ^^ en: 2 Junio 2010, 06:22 am

 ;-)
134  Foros Generales / Foro Libre / ¿A quién admiras? en: 1 Junio 2010, 07:49 am
Pregunta tonta respuesta fácil... No se por qué, pero me vino a la mente la pregunta. xDDDD

Yo a:

Richard M. Stallman
Brian H. May


Y por ahora no se me ocurre mas... Ya añadiré si crece el post XD
135  Informática / Electrónica / Motor y arduino en: 31 Mayo 2010, 22:46 pm
¿Es posible hacer para mover el eje de un motor eléctrico en 2 direcciones? Uso arduino
136  Programación / Programación C/C++ / Arduino: Encender y apagar Led en: 31 Mayo 2010, 03:52 am
http://foro.elhacker.net/electronica/arduino_encender_y_apagar_led-t295171.0.html

Como contiene código en C, posteo el enlace... ^^ A ver que opinan.
137  Informática / Electrónica / Arduino: Encender y apagar Led en: 31 Mayo 2010, 03:51 am
He creado un pequeño proyecto para encender y apagar un led conectado a Arduino, a través de un ejecutable escrito en C bajo GNU/Linux.

Códigos;

Archivo para GNU/Linux;

Código
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char ruta[13];
  5.  
  6. FILE *fp;
  7.  
  8. int pedirNum();
  9. void abrir();
  10.  
  11. int main(void)
  12. {
  13. int op, var;
  14. strncpy(ruta, "/dev/ttyUSB0", 13);
  15.  
  16. if ((fp=fopen(ruta, "a"))==NULL)
  17. {
  18. fprintf(stdout, "No se puede abrir el archivo\n");
  19. return 0;
  20. }
  21.  
  22. fcloseall();
  23.  
  24. do
  25. {
  26. fprintf(stdout, "Introduce valor (0 para salir)\n");
  27. var =pedirNum();
  28. if (var==0)
  29. {
  30. abrir(); putc(0, fp); fclose(fp);
  31. break;
  32. }
  33.  
  34. else
  35. {
  36. switch(var)
  37. {
  38. case 1: abrir(); putc(1, fp); fclose(fp); break;
  39. case 2: abrir(); putc(2, fp); fclose(fp); break;
  40. case 3: abrir(); putc(3, fp); fclose(fp); break;
  41. }
  42. }
  43. } while (1);
  44.  
  45. return 0;
  46. }
  47.  
  48. int pedirNum()
  49. {
  50. int valor;
  51. do
  52. {
  53. scanf("%d", &valor);
  54. } while (valor<0 || valor>3);
  55. return valor;
  56. }
  57.  
  58. void abrir()
  59. {
  60. if ((fp=fopen(ruta, "w"))==NULL)
  61. {
  62. fprintf(stdout, "Imposible abrir el archivo\n");
  63. }
  64. }

Archivo para Arduino;
Código
  1. int var;
  2. int ledPin =13;
  3.  
  4. void setup()
  5. {
  6.  Serial.begin(9600);
  7.  pinMode (ledPin, OUTPUT);
  8.  var =0;
  9. }
  10.  
  11. void loop()
  12. {
  13.  if (Serial.available() >0)
  14.  {
  15.    var =Serial.read();
  16.  
  17.    outtext(var);
  18.  
  19.    if (var==0)
  20.    {
  21.      Serial.print("End.\n");
  22.      offLeds();
  23.    }
  24.  
  25.    if (var==1)
  26.    {
  27.      digitalWrite(ledPin, HIGH);
  28.    }
  29.  
  30.    if (var==2)
  31.    {
  32.      digitalWrite(ledPin, LOW);
  33.    }
  34.  
  35.    if (var==3)
  36.    {
  37.      parpadea();
  38.    }
  39.  }
  40. }
  41.  
  42. void outtext (int valor)
  43. {
  44.  if (valor==1)
  45.    Serial.println("State 1 - ON");
  46.  if (valor==2)
  47.    Serial.println("State 2 - OFF");
  48.  if (valor==3)
  49.    Serial.println("State 3 - BLINK");
  50. }
  51.  
  52. void parpadea()
  53. {
  54.  int cont;
  55.  for (cont=0;cont<10;cont++)
  56.  {
  57.    digitalWrite(ledPin, HIGH);
  58.    delay(250);
  59.    digitalWrite(ledPin, LOW);
  60.    delay(250);
  61.  }
  62. }
  63.  
  64. void offLeds()
  65. {
  66.  digitalWrite(ledPin, LOW);
  67. }
  68.  



Versión actual: 0.2
* Añadida función Blink
* Añadido State 0; END.

Out Serial;

Citar
State 1 - ON

State 2 - OFF

State 3 - BLINK

End.




Como podéis ver, el Led está conectado a la salida digital 13, la cual incluye resistencia propia.

Vídeo de funcionamiento; (v. 0.1)




Quién quiera usar el código en otros sistemas operativos, solo tiene que cambiar la ruta del archivo de Arduino. Creo que no habría que cambiar mas, pues he usado funciones estándar ^^.

Si alguien quiere mejorar el code, o solamente opinar, ya sabéis, para eso estamos ^^.
138  Informática / Electrónica / Arduino: Cronómetro en: 31 Mayo 2010, 02:34 am
Código
  1. int seg =0;
  2. int mix =0;
  3. int hor =0;
  4. int b;
  5.  
  6. void setup()
  7. {
  8.  Serial.begin(115200);
  9.  
  10.  hor =17;  // Actual
  11.  mix =58;
  12.  seg =45;
  13.  b=1000;
  14. }
  15.  
  16. void loop()
  17. {
  18.  
  19.  int a =millis();
  20.  
  21.  if (a==b)
  22.  {
  23.    b+=1000;
  24.    seg++;
  25.  
  26.  
  27.    if (seg==60)
  28.    {
  29.      seg =0;
  30.      mix++;
  31.    }
  32.  
  33.    if (mix==60)
  34.    {
  35.      mix =0;
  36.      hor++;
  37.    }
  38.  
  39.    if (hor==23)
  40.    {
  41.      hor =0;
  42.      mix =0;
  43.      seg =0;
  44.    }
  45.    Serial.flush();
  46.    mostrar(hor, mix, seg);
  47.  }
  48. }
  49.  
  50. void mostrar (int hox, int mixx, int sex)
  51. {
  52.  Serial.print(hox);
  53.  Serial.print(";");
  54.  Serial.print(mixx);
  55.  Serial.print(";");
  56.  Serial.print(sex);
  57.  Serial.print("\n");
  58. }

¿Alguien me ayuda a mejorarlo? XD
139  Foros Generales / Foro Libre / Echo room en: 30 Mayo 2010, 01:30 am


Por Chuck que vergüenza... XDDD Si, eso soy yo.
140  Foros Generales / Foro Libre / Me llamo Julien Barreaux, tú mataste a mi personaje del Counter-Strike en: 29 Mayo 2010, 22:04 pm
http://www.gizmodo.es/2010/05/28/me-llamo-julien-barreaux-tu-mataste-a-mi-personaje-del-counter-strike-preparate-a-morir.html


 :huh: :huh: :huh: :-\ :-\ :-\
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 [14] 15 16 17
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines