0

I am currently using an Arduino Mega with a fast vibration sensor to trigger the components operation (force sensor, temperature sensor) and also toggle sleep mode.

I am very new at this and I have been doing some googling, but I just can't seem to understand it.

So, my questions are:

  1. How would I toggle(on/off) sleep mode?
  2. How would I use interrupts (timer, pin change interrupt?) for an analog pin that triggers when the vibration sensor is triggered, resulting in other components operating?

I am currently working on a Mega, but I will eventually move on to the Arduino Mini Pro. I hope there are no exclusive problems later on.

I realize that this is not a professional question, but I find these tasks very challenging.

Please help me. An example link or perhaps example code to help me understand better.

Thank you very much.

  • What do you mean by “an analog pin that triggers when the vibration sensor is triggered”? – Edgar Bonet Jan 17 '17 at 10:41
  • so when the vibration sensor gets triggered, then then the analog pin goes out of sleep mode(or the entire board goes out of sleep mode) and the analog pin will start getting inputs from external components in a specific frequency (how much is the analog reading [every 15 sec ]) – Worapat Sopa Jan 26 '17 at 2:31
  • 2
    You don't sleep an analog pin, you sleep the CPU. Given your current understanding level, you should really forget about your project for now and focus on learning the basics. Then go through tutorials about sleep mode and interrupts. If you get stuck on your learning process, you can use this site to ask focused questions. Once (and only once) you are comfortable with all that material, you can come back to your original project. You want to run an obstacle course: you should first learn to walk. – Edgar Bonet Jan 26 '17 at 8:37
-1

How would I use interrupts (timer, pin change interrupt?) for an analog pin that triggers when the vibration sensor is triggered, resulting in other components operating?

Thee best and most authoritative answer to that and all your other questions about the chip can be found in thee device data sheet and the compiler manual. Read them thoroughly and then write code to the data sheet to experiment.

Your can fire example have an analog interrupt where the chip constantly does ADC on the pin attached to the sensor and you can test the value of the ADC to see if certain trigger conditions are met and take appropriate actions.

The same with timers, etc. The data sheet is your best friend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.