Coding signal when Arduino switches on

Hello fellow Arduino enthusiasts,

I am currently working on an aid for blind people. For this project I am using a Digispark Pro 16 MHz. However, I believe that even if you only know the more common Arduino boards you can still help me.

I am trying to code in a sequence that starts up once the arduino is powered. Once I power up the Digispark I need it to make an vibration motor vibrate twice to inform the blind person that the device is switched on. It sounds simple, but right now I have no idea how to realize this. Can someone help me out?

Furthermore, I am also looking for ways in which i can make the digispark inform the person once the battery runs empty. I am using an external 9V battety to power it. Does someone know how I can do so?

Your vibrate twice code needs to be placed in the setup() routine where it will run once, only upon power up/start up.

Battery level is achieved by measuring battery voltage using a 10:1 voltage divider to reduce the 9 volts to approximately 0.9 voltsand and utilizing the AVR’s internal 1.1 volt reference. Arduino analogReference()

The actual battery chemistry used (carbon zinc, alkaline, etc) will establish the battery discharge curve and thus the low battery notification point. Rechargeable cells can be more problematic in this estimation than non-rechargeable types.

Thank you, I figured out the first part in about 5 minutes after posting my question. Thanks for the reply on the second part as well. I will look into it.

skyrocks99: Furthermore, I am also looking for ways in which i can make the digispark inform the person once the battery runs empty.

Well, if it gives two buzzes at start-up, a single short buzz at 30 or so second intervals might be a suitable "low battery" warning. But you commit the oh-so-common blunder of failing to tell us what your project is supposed to do. :roll_eyes:

skyrocks99: I am using an external 9V battery to power it. Does someone know how I can do so?

What? One of these? |336x500 Very bad idea! better to use three alkaline AAA cells in a carrier, direct to your Vcc.

skyrocks99: However, I believe that even if you only know the more common Arduino boards you can still help me.

Dead right. The Digispark website is absurdly secretive (or just hopelessly poorly maintained?) about exactly what the circuit schematic and the processor is, but apparently it is the Attiny167. If that is in the IDE, then pretty standard code will run.