Pages: [1]   Go Down
Author Topic: An LDR and servo motor controlled entertainment unit  (Read 1332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



What this is supposed to be:
An LDR and servo motor controlled artifact used in a easygoing manner to induce laughter and what not.
This was made as a sort of "gag" project for our teacher David Cuartielles the co-creator of Arduino. 

What he didn't tell us that week was that we had an additional 7 days after to showcase it via different mediums for the chance of winning different prizes.

So this week our whole class is preparing different types of "marketing schemes" to basically get as much viewers as possible (the ones with the most wins).

That's why we made this video showcasing our 1-week project.
http://www.youtube.com/watch?v=eW_06UF1Ok0&feature=youtu.be

This is the some of the code for making the head respond accordingly to the LDR sensor:

Code:
if (millis() - timer2 > 20) {
    if (LDRReading > 896) {   

      // first check the position, increase it and correct direction
      pos = pos + dir*inc;

      // correct to decrease
      if(pos >= 180) {
        pos = 180;
        dir = -1;
      }

      // correct to increase
      if(pos <= 0) {
        pos = 0;
        dir = 1;
      }

      // move the head   
      myservo.write(pos);

    }
    timer2 = millis();
  }

I've added the source files for those who are interested.

Thank you for reading and watching!

* ldrtest.ino (1.17 KB - downloaded 5 times.)
Logged

Pages: [1]   Go Up
Jump to: