Arduino Harlem Shake

We’re using an Arduino to program the heating cycle of a reflow oven in my medical instrumentation course. One afternoon I skipped my run in order to give my body a break from the pollen. (Everything outside has a not-so-lovely coat of yellow…) I thought it would be fun to make a dancing man special character for the Arduino LCD. But Dancing Man quickly morphed into Harlem Shake.

The code for the Harlem Shake is below:

//Create a dancing man on the LCD
#include <LiquidCrystal.h>

LiquidCrystal lcd(8,9,4,5,6,7);

int numbit = 16;
byte h1[8] = {
B00000,
B10100,
B01110,
B00101,
B01010,
B10001,
B00000,
};

byte h2[8] = {
B00000,
B00101,
B01110,
B10100,
B01010,
B10001,
B00000,
};

void setup(){
lcd.begin(16,2);
lcd.createChar(0,h1);
lcd.createChar(1,h2);
}

void loop(){
if (millis()/1000 <= 15){
lcd.setCursor(8,0);
lcd.write(byte(0));
delay(500);

lcd.setCursor(8,0);
lcd.write(byte(1));
delay(500);
}

if (millis()/1000 > 15 && millis()/1000 <= 30){
for (int x = 0; x < 16; x++, x++){
lcd.setCursor(x,0);
lcd.write(byte(0));

lcd.setCursor(x+1,1);
lcd.write(byte(0));
}
delay(200);
for (int x = 0; x< 16; x++,x++){
lcd.setCursor(x,0);
lcd.write(byte(1));

lcd.setCursor(x+1,1);
lcd.write(byte(1));
}
delay(200);
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s