Go Down

Topic: Running two pieces of code at once (Read 6630 times) previous topic - next topic


Apr 14, 2009, 05:30 pm Last Edit: Apr 14, 2009, 08:05 pm by roli Reason: 1
I will try it! The voltmeter show a value from 1.9V to 3.3V (Depends on the distance from the sensor).

EDIT: This seems to work but now I get multiple activations for one pass so I can't be 100%. I would use delay but that reference says that delay wont work in interrupt functions. I actualy tryed running and it detected me :o. So probaly only problem here are multiple activations.

EDIT2 : while this does work the other parts of code don't. The function that needs to write to some pins for very little time and then write to naother pin again for a few miliseconds doesn't work too good. Or it doesn't work at all. Depends on the moment when you run it.


Apr 16, 2009, 05:28 pm Last Edit: Apr 16, 2009, 05:40 pm by roli Reason: 1
Ok I am realy realy annoyed. My arduino is crazy! When I want to run a piece of code that writes to some pins in sequence it gets extremly strange. These pins control the motors but every time I run that piece of code the motor starts and never stops (until I press reset) I tryed NoInterrupts() but it doesn't help. So it does write high to the pin but then doesn't turn it off after 400ms delay. And when interrupt happens the arduino freezes again - sometimes. Without the interrupts the motors work better (so they start and stop) but the timing is strange. And it gets worse - When I put some pressure on the LCD this thing starts to work. So problem is with LCD screen and interrupts. I had to modify the LCD4Bit library to use analog pins as output but I just changed the pin where the comment indicated that I can change it.

Go Up