soso artist
Published © MIT

GLCD Dancing Man

Dancing Man in 1Sheeld GLCD.

BeginnerFull instructions provided1,773
GLCD Dancing Man

Things used in this project

Story

Read more

Schematics

GLCD Running Man.fzz

when you press on the button it starts dancing.

Code

GLCD_dancing_man.ino

C/C++
#define CUSTOM_SETTINGS
#define INCLUDE_GLCD_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>

GLCDEllipse head(36,64,25,25);
GLCDLine body(61,64,165,64);
GLCDLine armL(85,64,170,30);
GLCDLine armR(85,64,170,94);
GLCDLine legL(165,64,250,50);
GLCDLine legR(165,64,240,74);
GLCDLine mouth(45,54,45,74);
GLCDEllipse eyeL(30,74,5,5);
GLCDEllipse eyeR(30,54,5,5);

const byte danceButton = 7;
  
void setup()
{
  /* Start communication. */
  OneSheeld.begin();

  /* Clear the GLCD. */
  GLCD.clear();
  
  drawMan();
}

void loop() {
  if(digitalRead(danceButton)){
    legL.setCoordinates(165,64,250,30);
    legR.setCoordinates(165,64,240,94);
    armL.setCoordinates(85,64,170,30);
    armR.setCoordinates(85,64,170,94);
  
    legL.setCoordinates(165,64,250,69);
    legR.setCoordinates(165,64,240,60);
  
    legL.setCoordinates(165,64,250,94);
    legR.setCoordinates(165,64,240,30);
    armL.setCoordinates(85,64,150,30);
    armR.setCoordinates(85,64,150,94);
  
    legL.setCoordinates(165,64,250,60);
    legR.setCoordinates(165,64,240,69);
  }else{
    legL.setCoordinates(165,64,250,30);
    legR.setCoordinates(165,64,250,94);
    armL.setCoordinates(85,64,170,30);
    armR.setCoordinates(85,64,170,94);
  }
}

void drawMan()
{
  GLCD.draw(head);
  GLCD.draw(eyeL);
  //eyeL.setFill(true);
  GLCD.draw(eyeR);
  //eyeR.setFill(true);
  GLCD.draw(mouth);
  GLCD.draw(body);
  GLCD.draw(armL);
  GLCD.draw(armR);
  GLCD.draw(legL);
  GLCD.draw(legR);
}

Credits

soso artist

soso artist

3 projects • 1 follower

Comments