Section 1:
//IRRemote stuff
//IR Remote library
#include <IRremote.h>
int RECV_PIN = A0;
IRrecv irrecv(RECV_PIN);
decode_results results;
#include <string.h>
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(A1,A2);
WiFly wifly;
/* Change these to match your WiFi network */
const char mySSID[] = "[redacted]";
const char myPassword[] = "[redacted]";
const char site[] = "weather.yahooapis.com";
//String inString; // string for incoming serial data
//MP3Shield stuff
#include <SPI.h>
//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
//and the MP3 Shield Library
#include <SFEMP3Shield.h>
//create and name the library object
SFEMP3Shield MP3player;
byte result;
#include <TimerOne.h>
#include "LPD6803.h"
// Choose which 2 pins you will use for output.
// Can be any valid output pins.
int dataPin = A4;
int clockPin = A5;
// Timer 1 is also used by the strip to send pixel clocks
// Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row
LPD6803 strip = LPD6803(10, dataPin, clockPin);
void setup() {
Serial.begin(9600);
wifiSerial.begin(9600);
if (!wifly.begin(&wifiSerial, &Serial)) {
;
}
/* Join wifi network if not already associated */
if (!wifly.isAssociated()) {
/* Setup the WiFly to connect to a wifi network */
wifly.setSSID(mySSID);
wifly.setPassphrase(myPassword);
wifly.enableDHCP();
wifly.join();
wifly.setDeviceID("WWC");
}
wifly.setTimeAddress("193.47.164.28");
wifly.setTimezone(23);
wifly.setTimeEnable(2);
wifly.save();
// The Arduino needs to clock out the data to the pixels
// this happens in interrupt timer 1, we can change how often
// to call the interrupt. setting CPUmax to 100 will take nearly all all the
// time to do the pixel updates and a nicer/faster display,
// especially with strands of over 100 dots.
// (Note that the max is 'pessimistic', its probably 10% or 20% less in reality)
strip.setCPUmax(50); // start with 50% CPU usage. up this if the strand flickers or is slow
// Start up the LED counter
strip.begin();
// Update the strip, to start they are all 'off'
strip.show();
result = MP3player.begin();
if(result != 0) {
;
}
irrecv.enableIRIn(); // Start the receiver
}
//time (mins) MP3 sample last played
char lastPlayed[] = "-1";
//current clock mins
char currentMinute[3];
//current clock hours
char currentHour[3];
//for wifly.getTime()
char buf[9];
//holds return from wifly.getTime()
char *strTime;
//MP3 shield track name - tracks held on SD card
char trackName[] = "track000.mp3";
//2 digit Yahoo weather API code
char wCode[] = "xx";