I'm researching a project connecting arduino to processing. I'm looking to have processing retrieve data from a website that will have rotating pictures (.jpeg's changing every 10 seconds). Each time a new picture comes up a corresponding pattern will occur with LED lights attached to the arduino board. I've been working with arduino alone, programming patterns etc. and am new to working with serial connections and coding.
I've been looking at this tutorial Getting Started with Arduino Kit (the last two chapters. It seems like this is the right track, I'm wondering if anyone has any suggestions for how I could modify this code so that instead of what happens in the sketch, a text reading from the website would trigger a LED light, say PEACE triggers pin 13 on for etc....off for...? Or at least put me in the right direction in my research.
I'm wondering if anyone has any suggestions for how I could modify this code so that instead of what happens in the sketch, a text reading from the website would trigger a LED light, say PEACE triggers pin 13
That's exactly what that code does. What do you want to change?
I'm trying ultimately to make a website with a slide show that randomly reorders .jpegs. I then am trying to assign a pattern of LED's to each .jpeg, so the images will have a corresponding series of patterns. So for example
'example.jpeg' appears and a pattern such as
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(12, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(12, LOW); // set the LED off
delay(1000); // wait for a second
}
etc.. and so on for many different patterns. I'm unclear as to where or how I would assign a .jpeg to a set of patterns. And then where I would put the patterns in the sketch. Forgive my ignorance, I'm new to this!
I'm trying ultimately to make a website with a slide show that randomly reorders .jpegs.
This is getting more confusing, not less. If you have a web server running a slide show, how is that web server going to communicate with the Arduino? Do you think your web hosting people are going to allow you to connect your Arduino to their computer? Do you think that they are going to let you run an application on their machine that talks to your Arduino?
From what I understand, processing can analyze and record information from a website. I was thinking of trying to find out how processing can grab the data that a certain .jpeg is up on the site. And then send that info to the arduino. I was planning on running it off of my computer but connecting to a specific public website that I would make.
So, when Processing displays some picture, it sends a number (in binary) to the Arduino, via the serial port.
The Arduino reads the number from the serial port, and calls a function:
if(Serial.available() > 0)
{
int val = Serial.read();
switch(val)
{
case 1:
// Do pattern 1
break;
case 2:
// Do pattern 2
break;
case 3:
// Do pattern 3
break;
}
}
Add as many cases as you have pictures.
It is up to you to determine a relationship between a picture name and a number, and to determine which LEDs should be lit up when that number is sent.