[ubuntu-ar] Robotica Educativa con Linux...

Maxi maximiliano.duarte at gmail.com
Thu Feb 7 03:57:49 UTC 2013


El día 6 de febrero de 2013 17:37, Fernando Cassia <fcassia en gmail.com> escribió:
>
> 2013/2/6 Marcelo Martinovic <marcelo.martinovic en gmail.com>
>>
>> .
>> te recomiendo ver Arduino, hay muchisima documentacion, la programacion
>> del controlador es en c++, super simple y muy clara,
>
>
> defina ´super simple y muy clara´ yo nunca haría a un principiante programar
> en c++, sino algún lenguaje de más alto nivel, con algún layer de
> abstracción en medio.
>
>
> FC
>
>
> --
> During times of Universal Deceit, telling the truth becomes a revolutionary
> act
> Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto
> Revolucionario
> - George Orwell
>
> --
> Ubuntu-ar lista de correo
> Ubuntu-ar en lists.ubuntu.com
> Modifica tus opciones o desuscribite en:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-ar
> Siempre leer, comprender y aplicar nuestra etiqueta:
> https://wiki.ubuntu.com/ArgentinaTeam/EtiquetaML
>
>

Te respondo yo Fernando:
Soy apasionado hobbiesta y autodidacta de la electronica, y use
microcontroladores y aprendi a usarlos, pero cuando empezas tenes que
leer mucho y recordar que registro activa cada parte interna, por
ejemplo el pin2 para que funciones como interrupcion debes escribir el
bit 6 de registro INTR2, y esto cambia de pic, a atmel, a texas, etc.
En arduino o pinguino (Proyecto venezolano que usa pic en vez de
atmel) todo eso es transparente con solo llamar a la funcion
attachinterrupt() de configuran solos los registros.
Esto en principio parece cegar al alumno pero le da libertad para
poner en funcionamiento su idea y no frustrarse por no encontrar el
error de un bit equivocado.
Arduino usa c++ y c, el ide esta hecho sobre java, es muy basico pero
tiene cientos de librerias con Shield (llamemosla ampliaciones) y
ademas si ya sos programador avanzado podes modificar registros
internos y mezclar si te gusta asembler.
Y no necesitas de un programador, se autoprograma desde el mismo ide
conectado al puerto usb.
La orientacion a objetos es mas para el uso de las librerias, ya que
para la programacion es netamente estructurada.

Ejemplo de parpadeo de un led:
int led = 13;

void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Ejemplo de la lectura y escritura de una memoria SD:
#include <SD.h>

File myFile;

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  pinMode(10, OUTPUT);

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  if (SD.exists("example.txt")) {
    Serial.println("example.txt exists.");
  }
  else {
    Serial.println("example.txt doesn't exist.");
  }

  // open a new file and immediately close it:
  Serial.println("Creating example.txt...");
  myFile = SD.open("example.txt", FILE_WRITE);
  myFile.close();

  // Check to see if the file exists:
  if (SD.exists("example.txt")) {
    Serial.println("example.txt exists.");
  }
  else {
    Serial.println("example.txt doesn't exist.");
  }

  // delete the file:
  Serial.println("Removing example.txt...");
  SD.remove("example.txt");

  if (SD.exists("example.txt")){
    Serial.println("example.txt exists.");
  }
  else {
    Serial.println("example.txt doesn't exist.");
  }
}

void loop()
{
  // nothing happens after setup finishes.
}

--
El que pregunta aprende, y el que contesta aprende a responder.

No a la obsolecencia programada:
http://dimensionargentina.blogspot.com/2011/01/todo-esta-disenado-para-romperse.html

Linux User #495070
http://domonetic.com/blog



More information about the Ubuntu-ar mailing list