Hi All,
I am a newbie to both Arduino & C programming.
I am trying to figure out how to use the internal 16MHz clock pulse to run a counter, which will run a ISR say 100 times/second.
I assume there is a command for this & have been scouring the net for hours trying to find such an animal, but to no avail.
Lots of ways of doing it, but 100Hz is pretty slow - why do you need an interrupt?
(I don't want to put you off, but interrupts are tricky beasts, and really best reserved for very fast events).
I want to use the Arduino to control an espresso machine. Specifically I want to add a adjustable pressure system to an espresso machine
At all times I want to monitor/control the following :-Steam boiler level sensor, Steam boiler temp, Hot water dispense switch, Flowmeter x 2, Steam boiler manual fill switch, Steam Boiler water intake solenoid, Brew switch x 2, ? brew boiler PID output, Group head thermocouple.
Also during the course of an extraction I want to monitor the following :- Group head pressure sensor, Manual pressure profile potentiometer, PWM signal to pump.
I'm a newbie to Arduino & C++ also, but if it's any help, using the TimedAction.h library setting up an interrupt is relatively easy.
PS. I use this for updating a 4*20 LCD etc. I see no point in running code full whack all the time.
In addition, with a little extra work you can use this base 100mS loop to generate ticks for 300mS, 500mS, 1000mS etc etc.
#include <TimedAction.h>
// Initializes TimedAction - Timer Interrupt
TimedAction Timedact01 = TimedAction(100,TimerService01); // 100mS
void setup() {
}
void loop() {
// Timed Action service
Timedact01.check();
}
void TimerService01() {
// This subroutine runs at 100mS so put what you want in here, i.e. your counter.
}
@IanJohnston:
That's not an interrupt!
If you've got anything running in "loop" that takes a long time, then response to your scheduled event will also be delayed.
? I see no point in running code full whack all the time.
The processor is running full wack all the time even if you have no code in loop.
Using interrupts can increase rather than decrease the amount of work the chip has to do because there is overhead in the saving and restoring registers that is done in the interrupt handler.
Anyway, as groove says, timedAction does not use interrupts.