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. 



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);
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–) {
for(int i=0; i<textLength; i++) {


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’) {

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

*pixelPtr = pixelCount;
*lengthPtr = charCount;