Tuesday, January 15, 2013

Cool Gadgets for the Raspberry Pi

Here are some awesome new gadgets I found over the break

Small 4.3" Monitor
Great for prototyping
Small portable screen for the Raspberry Pi
NTSC

10000mAh battery
5V, 9V, and 12V Battery Pack
2 USB ports for charging

5200mAh
5V Portable Battery Pack
1 USB for charging external devices
1 Micro USB for charging the battery
It powered my Raspberry Pi streaming 1080p video for 4+ hours

Saturday, January 5, 2013

a fun after project . .. the ugly christmas sweater

so i decided to make an ugly sweater to win a nice friendly competition . . . here is my entry


video is on vimeo: https://vimeo.com/56826359

password: sensors

Here is the code that I used:

// ugly sweater v.2
byte oneYellow = 13;
byte oneRed = 12;
byte oneBlue = 11;
byte twoYellow = 10;
byte twoRed = 9;
byte twoBlue = 8;
byte thrYellow = 7;
byte thrRed = 6;
byte thrBlue = 5;
byte fourYellow = 4;
byte fourRed = 3;
byte fourBlu = 2;
int ledDelay; // delay between changes
unsigned long changeTime;
int potPin = A2; // select the input pins for the potentiometer



void setup(){
  pinMode(oneYellow, OUTPUT);
  pinMode(oneRed, OUTPUT);
  pinMode(oneBlue, OUTPUT);
  pinMode(twoYellow, OUTPUT);
  pinMode(twoRed, OUTPUT);
  pinMode(twoBlue, OUTPUT);
  pinMode(thrYellow, OUTPUT);
  pinMode(thrRed, OUTPUT);
  pinMode(thrBlue, OUTPUT);
  pinMode(fourYellow, OUTPUT);
  pinMode(fourRed, OUTPUT);
  pinMode(fourBlu, OUTPUT);
  changeTime = millis();
  pinMode(potPin, INPUT);
}

void loop(){
  int valPin = analogRead(potPin);
  unsigned long tmDelay = map(valPin, 0, 1023, 500, 0);
  digitalWrite(oneYellow, HIGH);
  digitalWrite(oneRed, HIGH);
  digitalWrite(oneBlue, HIGH);
  digitalWrite(twoBlue, LOW);
  digitalWrite(thrBlue, LOW);
  digitalWrite(fourBlu, LOW);
  delay(tmDelay);
  digitalWrite(twoYellow, HIGH);
  digitalWrite(twoRed, HIGH);
  digitalWrite(twoBlue, HIGH);
  digitalWrite(oneYellow, LOW);  
  digitalWrite(oneRed, LOW);
  digitalWrite(oneBlue, LOW);
  delay(tmDelay);
  digitalWrite(thrYellow, HIGH);
  digitalWrite(thrRed, HIGH);
  digitalWrite(thrBlue, HIGH);
  digitalWrite(twoYellow, LOW);
  digitalWrite(twoRed, LOW);
  digitalWrite(twoBlue, LOW);
  delay(tmDelay);
  digitalWrite(fourYellow, HIGH);
  digitalWrite(fourRed, HIGH);
  digitalWrite(fourBlu, HIGH);
  digitalWrite(thrYellow, LOW);
  digitalWrite(thrRed, LOW);
  digitalWrite(thrBlue, LOW);
  delay(tmDelay);
  digitalWrite(fourYellow, LOW);
  digitalWrite(fourRed, LOW);
  digitalWrite(fourBlu, LOW);
  digitalWrite(oneYellow, HIGH);
  digitalWrite(twoYellow, HIGH);
  digitalWrite(thrYellow, HIGH);
  digitalWrite(fourYellow, HIGH);
  delay(tmDelay);
  digitalWrite(oneYellow, LOW);
  digitalWrite(twoYellow, LOW);
  digitalWrite(thrYellow, LOW);
  digitalWrite(fourYellow, LOW);
  digitalWrite(oneRed, HIGH);
  digitalWrite(twoRed, HIGH);
  digitalWrite(thrRed, HIGH);
  digitalWrite(fourRed, HIGH);
  delay(tmDelay);
  digitalWrite(oneRed, LOW);
  digitalWrite(twoRed, LOW);
  digitalWrite(thrRed, LOW);
  digitalWrite(fourRed, LOW);
  digitalWrite(oneBlue, HIGH);
  digitalWrite(twoBlue, HIGH);
  digitalWrite(thrBlue, HIGH);
  digitalWrite(fourBlu, HIGH);
  delay(tmDelay);
  digitalWrite(twoBlue, LOW);
  digitalWrite(thrBlue, LOW);
  digitalWrite(fourBlu, LOW);
}