{"id":1134,"date":"2008-08-11T04:29:00","date_gmt":"2008-08-11T08:29:00","guid":{"rendered":"http:\/\/johncohn.org\/base\/2008\/08\/11\/sunday-night-bwahahaha\/"},"modified":"2008-08-11T04:29:00","modified_gmt":"2008-08-11T08:29:00","slug":"sunday-night-bwahahaha","status":"publish","type":"post","link":"http:\/\/johncohn.org\/base\/2008\/08\/11\/sunday-night-bwahahaha\/","title":{"rendered":"Sunday night &#8211; bwahahaha"},"content":{"rendered":"<p><div id=\"pBlogBody_423056433\" class=\"blogContent\">\n<center><\/p>\n<div align=\"left\">Blissfully little to report today. It was a great transition day from vacation.. nothing planned.. and not much attempted. Diane and I took the dogs for a run up honey hollow this morning. It was a bright, cool clear morning though it rained most o the rest of the day. <\/p>\n<p>Around 12:30 I drove over the Homer&#8217;s to pick up some of the microprocessors I&#8217;d left over there the other day. Unfortunately Homer and Mary were not home.. I think they were kayaking.. I grabbed my stuff and came back home. <\/p>\n<p>Buddy and Seth came over at 3 for a work session on the Haunted Forest Project-X project. We&#8217;ve been falling a bit behind on our schedule.. A bunch of the intern&#8217;s who are helping with the project  are about to go back to wherever they came form. i was determined to get the face animatronics done this week in time for our work session with Sara and Becca.. the articts.. on Wednesday night . <\/p>\n<p>We got a ton tun between about 3 and about 11 tonight. Seth Buddy and I finshed the mechanicals for the the face animations including the jaw that moves to sound\/voice, moiving eyebrows and lights that flicker and brighten in synch with the sound. <\/p>\n<p>I really enjoy workign with these kids.. they&#8217;re shapr prorammers.. It&#8217;s fun watching them get familiar witht he joys and limitations of 8 bit microcontrollers.  <\/div>\n<p><img decoding=\"async\" src=\"http:\/\/i147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/aug1008004.jpg\" \/><\/p>\n<div align=\"left\">We broke for a delicous dinner that Diane made&#8230;   We had a bunch of kids around for one reason oranother.. gabefriends, maxi&#8217;s freinds.. my project friends.. <\/p>\n<\/div>\n<p><img decoding=\"async\" src=\"http:\/\/i147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/aug1008003.jpg\" \/><\/p>\n<div align=\"left\">Dianemade a mutant vegan pizza.. it looked lik it was ready to explode when she pulled it out of the oven. <\/div>\n<p><img decoding=\"async\" src=\"http:\/\/i147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/aug1008002.jpg\" \/><\/p>\n<div align=\"left\">Then back to work.. Around 11:00 everythign came together. I&#8217;d finished the wiring and Seth had finished the programming. We actually got everything we needed done for ou rwednesday meeting with the artists who are doing the creatures skeleton . <\/div>\n<p><img decoding=\"async\" src=\"http:\/\/i147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/aug1008005.jpg\" \/><\/p>\n<div align=\"left\">We still have lot sof tuning to do.. but the creatures jaw moves and  eyebrows move to sound.. And it&#8217;s lighs flicker and brgheen as the sounds changes..   Here&#8217;s a low quality first example.. many more to come <\/div>\n<p><object type=\"application\/x-shockwave-flash\" allowscriptaccess=\"never\" allownetworking=\"all\" height=\"361\" width=\"448\" data=\"http:\/\/i147.photobucket.com\/player.swf?file=http:\/\/vid147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/bwahaha.flv\"><param name=\"allowScriptAccess\" value=\"never\"><\/param><param name=\"allowNetworking\" value=\"all\"><\/param><param name=\"movie\" value=\"http:\/\/i147.photobucket.com\/player.swf?file=http:\/\/vid147.photobucket.com\/albums\/r319\/johncohn\/aug1008\/bwahaha.flv\"><\/param><\/object> ..   <\/p>\n<div align=\"left\">If anyone&#8217;s interested.. here&#8217;s the Arduino code we wrote tongight.. Not beutiful.. but it&#8217;s fun to post code in your blog&#8230;<\/p>\n<hr class=\"jump\" \/><small><\/small><small><i>include ..nterrupt.h> \/\/ For interrupt functions cli() abd sei()<br \/>include ..o.h> \/\/ This file will look for the appropriate header file for the chip being used (ie., iom168.h will be included in our project)<br \/>include &#8220;Servo.h&#8221; \/\/ For open source servo library<\/p>\n<p>\/\/ Create a count value for the timer to reset to:<\/p>\n<p>static const unsigned char countValue = 6;<br \/>int in = 0;<br \/>int dimCounter = 0;<br \/>int yellowSwitch = 2;<br \/>int powerYellow = 0;<br \/>int yellowLED = 5;<br \/>int redLED = 3;<br \/>int inputVal = 0;<br \/>int mouthAvg = 0;<br \/>int inputTotal = 0;<br \/>int eyebrowVal = 0;<br \/>int inputArray16;<br \/>int i = 0;<br \/>int countMouth = 0;<br \/>int countEyebrow = 0;<br \/>boolean yellowOn = false;<\/p>\n<p>\/\/ Make a macro to reset the timer when called:<br \/>define RESET_TIMER2 TCNT2 = countValue<\/p>\n<p>\/\/ Evil global servo handlers:<br \/>Servo mouth;<br \/>Servo rightEyebrow;<br \/>Servo leftEyebrow;<br \/>\/\/ Timer 2 ISR:<br \/>ISR(TIMER2_OVF_vect)<br \/>{<br \/>  Servo::refresh();<br \/>  RESET_TIMER2;<br \/>}<\/p>\n<p>\/\/ Setup timer 2 to trigger an interrupt everytime it rolls over<br \/>void Timer2Init(void)<br \/>{<br \/>  \/\/Timer2 Settings: Timer Prescaler \/1024<br \/>  TCCR2B |= 0x07;  <br \/>  \/\/ Use normal mode<br \/>  TCCR2A |= 0x00;<br \/>  \/\/ Use internal clock<br \/>  ASSR |= 0x00;<br \/>  \/\/Timer2 Overflow Interrupt Enable<br \/>  TIMSK2 |= 0x01;<br \/>  \/\/ Reset the timer to whatever TIMER_COUNT is set to:<br \/>  RESET_TIMER2;  <br \/>}<br \/>void setup()<br \/>{<br \/>  \/\/ Initialize timer 2 for operation:  <br \/>  Timer2Init();<br \/>  \/\/ Enable interrupts (cli() will disable them)  <br \/>  sei();  <br \/>  mouth.attach(9);<br \/>  leftEyebrow.attach(10);<br \/>  rightEyebrow.attach(11);<br \/>  Serial.begin(9600);<br \/>}<\/p>\n<p>void loop()<br \/>{<br \/>  inputVal = analogRead(in);<br \/>  inputArraycountMouth = inputVal;<br \/>  countMouth ++;<br \/>  if (countMouth == 8)<br \/>    {<br \/>      countMouth = 0;<br \/>    }<br \/>  inputTotal = 0;<br \/>  for (i = 0; i <= 7; i ++)<br \/>    {<br \/>      inputTotal = inputTotal + inputArrayi;<br \/>    }<br \/>  mouthAvg = (inputTotal\/2)+80;<br \/>  mouthAvg = constrain(mouthAvg,80,120);<\/p>\n<p>  inputArraycountEyebrow = inputVal;<br \/>  countEyebrow ++;<br \/>  if (countEyebrow == 16)<br \/>    {<br \/>      countEyebrow = 0;<br \/>    }<br \/>  inputTotal = 0;<\/p>\n<p>  for (i = 0; i <= 15; i ++)<br \/>    {<br \/>      inputTotal = inputTotal + inputArrayi;<br \/>    }<br \/>    eyebrowVal = inputTotal;<\/p>\n<p>  if(analogRead(yellowSwitch) == 0)<br \/>      powerYellow++;<br \/>  if(powerYellow > 0 &amp;&amp; powerYellow < 255)<br \/>    {<br \/>      dimCounter++;<br \/>      if(dimCounter % 16 == 0)<br \/>        {<br \/>          powerYellow++;<br \/>          yellowOn = true;<br \/>        }<br \/>    }<br \/>  if(yellowSwitch == LOW &amp;&amp; yellowOn)<br \/>      powerYellow = 0;<\/p>\n<p>  if(inputVal>=8 &amp;&amp; yellowOn)<br \/>     {<br \/>       analogWrite(redLED,random(100)); <br \/>     }<br \/>   else<br \/>     {<br \/>       analogWrite(redLED,0);<br \/>     }<br \/>  eyebrowVal = eyebrowVal\/16;<br \/>  analogWrite(yellowLED,powerYellow);<br \/>  rightEyebrow.write(eyebrowVal);<br \/>  leftEyebrow.write(150 &#8211; eyebrowVal);<\/p>\n<p>  mouth.write(mouthAvg);<br \/>  Serial.print(inputVal);<br \/>  Serial.print(&#8221; &#8220;);<br \/>  Serial.print(eyebrowVal);<br \/>  Serial.print(&#8221; &#8220;);<br \/>  Serial.print(analogRead(yellowSwitch));<br \/>  Serial.println();<br \/>}<\/p>\n<p> <\/i><\/small><\/p>\n<hr class=\"jump\" \/>\n<p> And there you have it.. the source code for my day.. OK.. I gotta get to selep now.. Gnood night to you all. G&#8217;nite Sam !<br \/>-me<\/p>\n<\/div>\n<p><\/center>\n<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Blissfully little to report today. It was a great transition day from vacation.. nothing planned.. and not much attempted. Diane and I took the dogs for a run up honey hollow this morning. It was a bright, cool clear morning though it rained most o the rest of the day. Around 12:30 I drove over &hellip; <a href=\"http:\/\/johncohn.org\/base\/2008\/08\/11\/sunday-night-bwahahaha\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Sunday night &#8211; bwahahaha<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1134","post","type-post","status-publish","format-standard","hentry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/posts\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/comments?post=1134"}],"version-history":[{"count":0,"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"wp:attachment":[{"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/johncohn.org\/base\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}