Difference between revisions of "Implementing Arduino using Generic Serial Device"
Daballiemo (Talk | contribs) (→Setting up Arduino Uno and LinuxMCE to be able to control a RGB LED string) |
Daballiemo (Talk | contribs) (→Setting up Arduino Uno and LinuxMCE to be able to control a RGB LED string) |
||
Line 16: | Line 16: | ||
First is setting up Linuxmce. | First is setting up Linuxmce. | ||
− | 1) For now define Arduino as a vendor via Advanced -> Device Templates. Select the "Add Manufacturer" button and provide "Arduino" as manufacturer followed by save and close. | + | 1) For now define Arduino as a vendor via Advanced -> Device Templates. Select the "Add Manufacturer" button and provide "Arduino" as manufacturer followed by save and close. |
− | 2) | + | 2) |
== Arduino Uno - 1004 Setup == | == Arduino Uno - 1004 Setup == |
Revision as of 08:19, 7 September 2012
Version | Status | Date Updated | Updated By |
---|---|---|---|
710 | Unknown | N/A | N/A |
810 | Unknown | N/A | N/A |
1004 | In Progress | 3th September 2012 | Daballiem0 |
1204 | Unknown | N/A | N/A |
1404 | Unknown | N/A | N/A |
Usage Information |
General Info (Information not valid yet)
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software running on a computer (e.g. Flash, Processing, MaxMSP).
Setting up Arduino Uno and LinuxMCE to be able to control a RGB LED string
In the following I want to give an overview what needs to be done to have LinuxMCE control a RGB LED (string) through an Arduino. The string is within brackets as the only added to the Arduino to be able to control a ledstring is some mosfets and a powerblock.
First is setting up Linuxmce.
1) For now define Arduino as a vendor via Advanced -> Device Templates. Select the "Add Manufacturer" button and provide "Arduino" as manufacturer followed by save and close. 2)
Arduino Uno - 1004 Setup
Prepare the Arduino Uno;
Shopping list:
Arduino Uno Ethernet Shield IDE installed on computer
Sketch to upload to Arduino;
/* * Arduino LMCE interlink * * A basic example displaying the ability of LinuxMCE * to control an LED on an Arduino with * an ethernet shield. * * Daballiemo * http://linuxmce.org */ #include <SPI.h> #include <Ethernet.h> int switchPin = 2; int LEDpin = 5; //LED set to pin 5 int x; byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //must give WIZnet a MAC byte ip[] = { 192, 168, 80, 129 }; //must configure WIZnet IP EthernetServer server = EthernetServer(69); //TCP port the server is listening on, I'm using port 69, but you could use any void setup() { Ethernet.begin(mac, ip); server.begin(); Serial.begin(9600); //for troubleshooting purposes (not needed) pinMode(LEDpin, OUTPUT); pinMode(switchPin, INPUT); // sets the digital pin as input to read switch } void loop () { EthernetClient client = server.available(); //client connects to server if (client){ //if connection present x = client.read(); //read information coming from server Serial.println(x);} //print to serial (troublshooting only) if (x == 49){ //if information sent is a zero digitalWrite(LEDpin, LOW);} //turn of LED else if (x == 48){ //if information sent is a one digitalWrite(LEDpin, HIGH);} //turn on LED else if (x == 2){ //if information sent is a two digitalWrite(LEDpin, HIGH); //blink the LED delay(500); digitalWrite(LEDpin, LOW); delay(500);} if (digitalRead(switchPin) == 1){ Serial.println("Button has been pressed " ); server.write("Button has been pressed ");} // Read the pin and display the value }
Prepare the LMCE Enviroment;
Setting up the Arduino to be controlled through GSD