PIR->WaveShield->Speakers +total noob

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
vanDude
 
Posts: 55
Joined: Tue Mar 08, 2011 11:37 am

Re: PIR->WaveShield->Speakers +total noob

Post by vanDude »

what language do I use to create the timestamp - millis() equation?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: PIR->WaveShield->Speakers +total noob

Post by adafruit_support_bill »

You should get familiar with the language reference page of the Arduino site. http://arduino.cc/en/Reference/HomePage

This link shows examples of comparison operators: http://arduino.cc/en/Reference/If

vanDude
 
Posts: 55
Joined: Tue Mar 08, 2011 11:37 am

Re: PIR->WaveShield->Speakers +total noob

Post by vanDude »

Can I put it this way? If time > 10000 (10 seconds), wave.stop?

Code: Select all

void playcomplete(char *name)
{
  // call our helper to find and play this name
  playfile(name);
  while (wave.isplaying)
  {
if (digitalRead(14) == HIGH)  
{
time = 0;
}
if (digitalRead(14) == LOW)  
{
time = millis();
if(time > 10000);
{
wave.stop
}
          return;
      }
  }

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: PIR->WaveShield->Speakers +total noob

Post by adafruit_support_bill »

vanDude, We are 7 pages into this thread and you are still asking the most basic of questions. We can help you get started and get you over the tough spots, but at some point you need to take the initiative and figure some things out for yourself.
Can I put it this way?
This is a question you can answer by clicking the triangular button at the left of the toolbar. Does it compile? If not, then the simple answer is no. There are plenty of resources (including the languaage reference link I posted earlier) that can help you out there.

When you get it to compile, then go for the "upload" button and see what it does. Programming is mostly an iterative process. Don't be afraid to try things. You aren't going to break anything if you don't get it right the first time. :D

vanDude
 
Posts: 55
Joined: Tue Mar 08, 2011 11:37 am

Re: PIR->WaveShield->Speakers +total noob

Post by vanDude »

Right, sorry. Thanks for helping me out this much. As this is my first brush with coding I'm daunted and don't even know where to begin. I'll be more adventurous.

I've actually realized a workaround that will make this much easier and will improve the look of the bathroom. It was decided to also put the bathroom fan and light on a Lutron motion activated switch, so I just put another outlet on the box that that interrupts and now I can just have the Shield play upon being powered up by that switch, which works nicely. This means there will be one PIR instead of two.

Now, I'm looking at this thread
http://forums.adafruit.com/viewtopic.ph ... ong#p78996
to make it play random songs on startup. I'll tinker around a good while before coming back with any questions.

Cheers

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: PIR->WaveShield->Speakers +total noob

Post by adafruit »

hi vanDude, we're glad to do the best we can to help customers but the forums are really meant to get the products and kits -running-. We dont offer consulting services, personalized teaching, or project handholding for a $20 kit.

To make it easier on everyone (including yourself! :) ) please do the following before posting more questions:

- complete all of our ladyada.net tutorials
- learn and practice C using any of the many many online tutorials or books (google for this information, spend a few hours just -looking- for a good set of tutorials)
- purchase and complete the projects in a arduino book over 50 pgs - Beginning Arduino and 30 Arduino projects for the Evil Genius are a good start

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”