Dear all,
that's my first post on the forum ^_^. I'm based in France. I'm new in the community, new with Arduino, and... new with C...
Sorry for my message, it will be a little bit long... (well, it is long as I'm lost)
I have at home a 10$ arduino nano v3 from China, seems to be good quality (from powermcu.com)
I would like to use my Arduino for a basic function... but I'm a little bit lost.
My car is equiped with central locking and electric windows. I would like to open a window from my remote control which has only one button. The only way to do that is by something like "if I click 3 times on the button into 3 seconds the window will open".
So it means if I open-close-open within 3 seconds the window will open. I can detect opening by connecting on the positive terminal of the lock-motor. The lock motor has two terminals let say A and B. A is + and B is - when opening and A is - and B is + at closing.
So it means that if two positive pulse are detected within 3 seconds on an Arduino input I send a pulse to an output (this pulse will be connected on the window-command).
Ok so I belive the code is very simple and I thought the way to do that was to use attachInterrupt(), as I'm really newbe with this I tried to understand this command by using a very simple example I found on the web about attachInterrupt(), but... my Arduino freeze with this code (I mean after few contact on +Vcc and the input: data are not sent anymore to the COM port):
![]()
volatile int countPulse=0;
void setup() {
Serial.begin(9600);
attachInterrupt(0, toDo, RISING);
void loop(){
void toDo() {
countPulse=countPulse+1;
Serial.print("TOTAL COUNT = ");
Serial.println(countPulse);
}
}
So what goes wrong, is attachInterrupt() a bad way to do what I want ?
I don't ask you for the complete code (even if for me it will only take few lines !!!), it's not a good way to begin but is there anyone of you who can give me the right direction to begin ?
Thank you very much, merci beaucoup ![]()