[#XDUINO] #Arduino vs #Netduino vs #NetGadgeeter (II), use the Arduino

image

Series:

  1. Introduction, http://elbruno.com/2013/07/14/xduino-arduino-vs-netduino-vs-gadgeteer-i-2/

Hi,

After the post of introduction today I start to create the app for example with Arduino. For this I have used the following hardware

The Arduino one Rev 3 is one of the most popular, and Groove kit, allows us to connect the sensors and actors to the plate in an easy way without having to deal with wires in craft.

As well with the hardware complete, the following is working with development tools. This is simpler:

The next step is to assemble the hardware, very simple step:

  • Connect LED to pin 6
  • Connect the BUTTON to pin 9

image

And we are going to create the application.

1. In Visual Studio 2012 created a new Arduino project

image

2. Once the project is created, select the board Arduino Uno with the menu “Tools / / Arduino / / Boards / / Arduino Uno”. From the same menu we select the COM port to connect our Arduino.

image

If you do not know to which port is connected to your arduino, this post can help you.

3 Add the application code

   1: const int buttonPin = 8; // the number of the pushbutton pin
   2: const int ledPin =  6;   // the number of the LED pin
   3: int buttonState = 0;     // variable for reading the pushbutton status
   4: bool ledState = false;
   5:  
   6: void setup()
   7: {
   8:     pinMode(buttonPin, INPUT);     
   9:     pinMode(ledPin, OUTPUT);      
  10: }
  11:  
  12: void loop()
  13: {
  14:     buttonState = digitalRead(buttonPin);
  15:     if (buttonState == HIGH)
  16:     {
  17:         ledState = !ledState;
  18:         delay(500);
  19:     }
  20:     if(ledState)
  21:     {
  22:         digitalWrite(ledPin, HIGH); // LED ON
  23:     }
  24:     else
  25:     {
  26:         digitalWrite(ledPin, LOW);  // LED OFF
  27:     }
  28: }

4. The code is quite simple, only I must highlight the following

-Then check the status of the Button (line 15) change the State of a flag by true or false and apply a delay from 500 to some reaction on the plate. If you do not add this delay click executes as many times as the loop pass by that function. There are more elegant ways of doing this, it is Winking smile

5 I display the application (F5!) In the output panel will see a message similar to the following (amazing app 1 Kb!)

Compiling ‘ Xduino02′ for ‘Arduino Uno’
Binary sketch size: 1274 bytes (4% of to 32256 byte maximum) (0.23 secs)
Uploading to I/O board using ‘ COM3′
Done uploading

6. My application is running (I leave the video that perhaps will become viral)

And ready, in 28 lines of code I have my application running. In the next post, we will see if we do the same with Netduino or .net Gadgeteer.

Saludos @ Home

El Bruno

image image image
About these ads

Un pensamiento en “[#XDUINO] #Arduino vs #Netduino vs #NetGadgeeter (II), use the Arduino

  1. Pingback: [#XDUINO] Arduino vs Netduino vs Gadgeteer (VIII) Links | El Bruno

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s