So, I have total control over my LEDs via the Arduino. But what would take this to the next level?

Connect it to the Internet!

Fortunately, this is relatively simple to do – however it requires that you get an Arduino that either has ethernet/wifi capability or you can extend the functionality with an Ardunio Shield that supports this.

I didn’t want to buy another controller, so I decided to go the second route. I bought and Arduino Ethernet Shield, which was fairly simple to set up and installed the library. Within minutes, I was connected!

I found this article : Getting Data From The Internet which gave me the Arduino sketch that I needed to pull information into the Arduino. This was huge, because it meant I was one step closer to making my project a reality. I could send information to the Arduino and have it pass that information along to the LEDs.

Here’s a sample of the Arduino sketch that I’m using:

 

#include <avr/power.h>
#include <SPI.h> // needed for Arduino versions later than 0018
#include <Ethernet.h>
#endif

#define PIN 6

//ETHERNET

////////////////////////////////////////////////////////////////////////
//CONFIGURE
////////////////////////////////////////////////////////////////////////
byte server[] = { xxx,xxx,xxx,xxx }; //ip Address of the server you will connect to

//The location to go to on the server
//make sure to keep HTTP/1.0 at the end, this is telling it what type of file it is
String location = "/server_folder/ HTTP/1.0";

// if need to change the MAC address (Very Rare)
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
////////////////////////////////////////////////////////////////////////

EthernetClient client;

char inString[64]; // string for incoming serial data
int stringPos = 0; // string index counter
boolean startRead = false; // is reading?

void setup() {
Ethernet.begin(mac);
Serial.begin(9600);
}

void loop(){

spell();

}

// Spell Word
void spell() {

String pageValue = connectAndRead(); //connect to the server and read the output
Serial.println(pageValue); //print out the findings.

String total = getValue(pageValue, ',', 0);
int totalCount = total.toInt();

for( int x=1; x <= totalCount; x++){

String pixel = getValue(pageValue, ',', x);

int finalPixel = pixel.toInt();
randColor1 = random(0, 255);
randColor2 = random(0, 255);
randColor3 = random(0, 255);
strip.setPixelColor(finalPixel, randColor1, randColor2, randColor3);
strip.show();
delay(2500);
strip.setPixelColor(finalPixel, 0, 0,0);
delay(100);
}

}

 

Now that my Arduino had a way to send and receive information – I had to figure out how I would tap this in to my LED project.  What if I could make it so that people could control the LEDs? Stay tuned for the next part of my project!