Updates from November, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • yongjaelee2011 9:08 pm on November 26, 2011 Permalink | Reply  

    Smile Box 

    Using a LOL Shield and tilt sensor, I made an smile box. The smile box greets with text ” HEY SHAKE ME!”. When a user rotate the smile box, it shows smile animation.

    #include “Charliplexing.h”
    #include “Font.h”
    #include “WProgram.h”

    byte line = 0;
    char buffer[10];
    int value;

    int tiltPin = A0;

    int tiltState = 0;

    /* —————————————————————– */
    /** MAIN program Setup
    */
    void setup() // run once, when the sketch starts
    {
    LedSign::Init(); //initiate the screen

    // debounce setup
    pinMode(tiltPin, OUTPUT);
    }
    /* —————————————————————– */
    /** MAIN program Loop
    */
    void loop()
    {
    tiltState = digitalRead(tiltPin);
    if(tiltState == HIGH){
    animation();
    }
    else {
    textScroll();
    }
    }

    void textScroll()
    {
    char test[]=”HEY SKAKE ME!”;

    int8_t x=0,x2=0;
    for(int8_t j=13;j>-100;j–) {
    x=j;
    LedSign::Clear();
    for(int i=0;i<17;i++) {
    x2=Font::Draw(test[i],x,0);
    x+=x2;
    if (x>=13) break;
    }
    delay(80);
    }
    delay(3000);
    }

    void animation(){

    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(528);
    DisplayBitMap(480);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(1008);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(12483);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(8193);
    DisplayBitMap(9753);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(8385);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(14343);
    DisplayBitMap(9753);
    DisplayBitMap(10533);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(8193);
    DisplayBitMap(8385);
    DisplayBitMap(14343);
    delay(300);
    DisplayBitMap(8641);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(288);
    DisplayBitMap(528);
    DisplayBitMap(0);
    DisplayBitMap(8673);
    delay(300);
    DisplayBitMap(8873);
    DisplayBitMap(1560);
    DisplayBitMap(4290);
    DisplayBitMap(0);
    DisplayBitMap(1040);
    DisplayBitMap(10793);
    DisplayBitMap(10249);
    DisplayBitMap(0);
    DisplayBitMap(10373);
    delay(300);
    DisplayBitMap(6150);
    DisplayBitMap(8193);
    DisplayBitMap(8193);
    DisplayBitMap(192);
    DisplayBitMap(288);
    DisplayBitMap(192);
    DisplayBitMap(8193);
    DisplayBitMap(8193);
    DisplayBitMap(6150);
    delay(300);
    DisplayBitMap(2052);
    DisplayBitMap(1512);
    DisplayBitMap(10773);
    DisplayBitMap(5322);
    DisplayBitMap(1320);
    DisplayBitMap(5322);
    DisplayBitMap(10773);
    DisplayBitMap(1512);
    DisplayBitMap(2052);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(6150);
    DisplayBitMap(9225);
    DisplayBitMap(1008);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(12771);
    DisplayBitMap(3612);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(3096);
    DisplayBitMap(4644);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(10249);
    DisplayBitMap(2032);
    DisplayBitMap(0);
    delay(300);
    DisplayBitMap(0);
    DisplayBitMap(1560);
    DisplayBitMap(2340);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(0);
    DisplayBitMap(1032);
    DisplayBitMap(1008);
    DisplayBitMap(0);

    }

    void DisplayBitMap(int lineint)
    {
    //int data[9] = {95, 247, 123, 511, 255, 1, 5, 31, 15};

    //for(line = 0; line < 9; line++) {
    for (byte led=0; led<14; ++led) {
    if (lineint & (1<
    LedSign::Set(led, line, 1);
    }
    else {
    LedSign::Set(led, line, 0);
    }
    }

    line++;
    if(line >= 9) line = 0;
    }

     
  • josefayala 1:12 am on November 26, 2011 Permalink | Reply  

    Josef Ayala-Wake Box 

    This project is comprised of an Arduino UNO board, an LoL Shield, and a tilt sensor. Using the tilt sensor when it is attached to a baseball cap should reflect when I am asleep. My head hanging down should show that the tilt sensor is ON and beginning the scrolling text which says “WAKE ME UP YO”. When someone sees this they will ideally wake me up and when I lift my head the tilt sensor would tilt OFF and stop creating the Scrolling Text. The premise for this project is that it would be used in the train station during my evening commute to help me NOT miss my stop in Harlem. 

     

    <code>

    const int buttonPin = A4;     // the number of the pushbutton pin
    int buttonState = 0;         // variable for reading the pushbutton status

    #include “Charliplexing.h”
    #include “Font.h”
    #include “WProgram.h”

    // Technically the number of columns of LEDs minus one
    #define SCREEN_WIDTH 13

    // Scroll delay: lower values result in faster scrolling
    #define SCROLL_DELAY 80

    /* How long to wait after the last letter before
    going back to the beginning and repeating */
    #define REPEAT_DELAY 500

    int textLength, totalPixels;
    char text[]=”WAKE ME UP YO”;

    void setup() {
    // initialize the pushbutton pin as an input:
    pinMode(buttonPin, INPUT);
    LedSign::Init();
    getLength(text, &textLength, &totalPixels);
    }

    void loop(){
    // read the state of the pushbutton value:
    buttonState = digitalRead(buttonPin);

    // check if the pushbutton is pressed.
    // if it is, the buttonState is HIGH:
    if (buttonState == LOW) {
    int x=0;
    for(int j=SCREEN_WIDTH; j>-totalPixels-SCREEN_WIDTH; j–) {
    x=j;
    LedSign::Clear();
    for(int i=0; i<textLength; i++) {

    if (x>=SCREEN_WIDTH)
    break;
    }
    delay(SCROLL_DELAY);
    }
    delay(REPEAT_DELAY);

    }
    else {

    }
    }

    void getLength(char* charArray, int* lengthPtr, int* pixelPtr) {
    /* Finds the length of a string in terms of characters
    and pixels and assigns them to the variable at
    addresses lengthPtr and pixelPtr, respectively. */

    int charCount = 0, pixelCount = 0;
    char * charPtr = charArray;

    // Count chars until newline or null character reached
    while (*charPtr != ” && *charPtr != ‘\n’) {
    charPtr++;
    charCount++;

    /* Increment pixelCount by the number of pixels
    the current character takes up horizontally. */
    pixelCount += Font::Draw(*charPtr,-SCREEN_WIDTH,0);
    }

    *pixelPtr = pixelCount;
    *lengthPtr = charCount;
    }

    </code>

     
  • hirumi 12:20 am on November 26, 2011 Permalink | Reply  

    Digital Aquarium 

    For this project, I used an arduino, tilt sensor, photocell, and LOLshield to create a digital aquarium. At rest, the fish sits peacefully in its tank. If the tank is disturbed, the water flows and the fish swims around. The fish can also be fed food by placing your hand at the opening of the tank.


    Fish at rest


    Food dropping in

    The animation was created using the LOLshield theater. A photo cell was used to control the food animation, and the tilt sensor for the fish swimming.

    The video in this post is a slight upgrade to what I showed in class. The animation was originally kind of confusing, because the water flow didn’t include the fish and wasn’t at the same height as the “fish at rest” position. I tweaked it so that the fish swam around when the tank was disturbed, which usually is what happens when you shake/tap a fish tank.

    To make this project a bit better, I need to fix a couple of the dead LEDs that are on the board. I’d also like to change the interior of the tank; maybe framing the LOL shield in a castle, and placing the castle on gravel/marbles and using blue tissue paper. The vase does look better than my first enclosure though. It was a plastic cube, see below.

    
    #include <Charliplexing.h> //Imports the library, which needs to be
    
    byte line = 0; //Row counter
    char buffer[10];
    int value;
    
    int buttonPin = A4; // the number of the pushbutton pin
    int photoPin = A5; // photocell pin
    int val = 0; // value of photocell input
    int buttonState = 0; // variable for reading the pushbutton status
    
    void setup()
    {
     Serial.begin(9600);
     LedSign::Init(); //Initializes the screen
     // initialize the LED pin as an output:
    
    // initialize the pushbutton pin as an input:
     pinMode(buttonPin, INPUT);
     pinMode(photoPin, INPUT);
    }
    
    void loop(){
     // read the state of the pushbutton value:
     buttonState = digitalRead(buttonPin);
     val = analogRead(photoPin);
     Serial.println(val);
    
    // check if the pushbutton is pressed.
     // if it is, the buttonState is HIGH:
     if (val <=600){
     eat();
     }
    
     if (buttonState == HIGH) {
     Serial.println("look at fish");
    
    delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
    
     }
     else {
     Serial.println("sea is flowing");
    
    delay(700);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(9284);
     DisplayBitMap(13926);
     DisplayBitMap(16383);
     delay(700);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(2184);
     DisplayBitMap(11468);
     DisplayBitMap(16383);
     delay(700);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(4369);
     DisplayBitMap(6553);
     DisplayBitMap(16383);
     delay(700);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     delay(700);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(2184);
     DisplayBitMap(3276);
     DisplayBitMap(16383);
    
     }
    }
    
    void DisplayBitMap(int lineint)
    {
     //int data[9] = {95, 247, 123, 511, 255, 1, 5, 31, 15};
    
     //for(line = 0; line < 9; line++) {
     for (byte led=0; led<14; ++led) {
     if (lineint & (1<<led)) {
     LedSign::Set(led, line, 1);
     } else {
     LedSign::Set(led, line, 0);
     }
     }
    
     line++;
     if(line >= 9) line = 0;
    }
    
    void eat()
    {
     delay(100);
     DisplayBitMap(16);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(16);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1108);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9846);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(16);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(29);
     DisplayBitMap(30);
     DisplayBitMap(13);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(1092);
     DisplayBitMap(9830);
     DisplayBitMap(16383);
     DisplayBitMap(0);
     DisplayBitMap(13);
     DisplayBitMap(30);
     DisplayBitMap(13);
    }
    
    
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel