top of page
Blog: Blog2
sal5014

P.Comp Week 6: It's alive! Kinda?

Week 6 of P.Comp kinda broke our brains a little as we continued to work on our monster. Last week we made 5 ultrasonic distance sensors to work together.


This week we worked with a motion sensor, which we hope will be the trigger for beginning some of the sequences (trigger eyes open and some sounds) and a 8x8 LED matrix that we are hoping would be the eyes of our monster. We determined 6 states for the eyes to try an simulate real reactions:

1. Eyes Closed / Sleeping

2. Eyes Open

3. Eyes to the Right

4. Eyes to the left

5. Eyes Extreme Right

6. Eyes Extreme Left


Code Below:


#include<LedControl.h> LedControl lc = LedControl(12,11,10,1);

unsigned long delaytime=100;

void eyesWakeup(){

  byte b[8]= {B00111100,B01000010,B10011001,B10100100,B10100010,B10010010,B01000100,B00111000};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

void eyesSleeping(){

  byte b[8]= {B00000000,B00000000,B00000000,B11111111,B11111111,B00000000,B00000000,B00000000};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

void eyesleft(){

  byte b[8]= {B11000000,B00100000,B10010000,B01000000,B00100000,B00100000,B01000000,B10000000};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

void eyesright(){

  byte b[8]= {B00000011,B00000110,B00001001,B00001010,B0001010,B0001001,B00000100,B00000011};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

void eyeslefthalf(){

  byte b[8]= {B11100000,B00010000,B11001000,B00100000,B00010000,B10010000,B00100000,B11000000};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

  void eyesrighthalf(){

  byte b[8]= {B00000111,B00001000,B00010011,B00010100,B00010100,B00010010,B00001000,B00000111};

  lc.setRow(0,0,b[0]);   lc.setRow(0,1,b[1]);   lc.setRow(0,2,b[2]);   lc.setRow(0,3,b[3]);   lc.setRow(0,4,b[4]);   lc.setRow(0,5,b[5]);   lc.setRow(0,6,b[6]);   lc.setRow(0,7,b[7]);   lc.setRow(0,8,b[8]);   }

void setup() {   // put your setup code here, to run once:   lc.shutdown(0,false);   /* Set the brightness to a medium values */   lc.setIntensity(0,8);   /* and clear the display */   lc.clearDisplay(0);

}

void loop() {   // put your main code here, to run repeatedly:    eyesSleeping();    delay(1000);    eyesWakeup();    delay(1000);    eyeslefthalf();    delay(1000);    eyesleft();    delay(1000);    eyeslefthalf();    delay(1000);    eyesWakeup();    delay(1000);    eyesrighthalf();    delay (1000);    eyesright();    delay (1000); }


Result:

An eye sequence that goes to closed --> open--> slightly left --> left -->slightly left --> center --> slightly right --> right



The next steps are to read the distance input of the sensors, sort them to pick the shortest distance (code) and assign an eye state to each sensor so the eyes seem to move towards the sensor with the shortest distance.


We are also getting 2 LED matrixes that are 16x16 to get a better and bigger definition on our eyes.


We have also gotten some sounds to play on speakers. We attempted to use serial communication to get the arduino to play the sounds from a computer but we couldn't figure out that part.


As for the body of our monster it's looking fairly good, we are only missing one more layer to make it sturdy and then carve out the eyes:





11 views0 comments

Recent Posts

See All

Komentar


bottom of page