In my Arduino file, TimerTest.ino
#include "Arduino.h"
#include "Pulse.h"
#include <elapsedMillis.h>
elapsedMillis timeElapsed ;
Pulse trigger(45,60) ; //45 is pin number, 60 is pulse interval in msec
When I defined Pulse.cpp
#include "Arduino.h"
#include "Pulse.h"
Pulse::Pulse(int pin, long interval)
{
_pin = pin ;
pinMode(_pin, OUTPUT);
_interval = interval);
}
void Pulse::PulseOut()
{
if(timeElapsed > _previousTime + _interval)
digitalWrite(_pin,LOW);
}
I got a compiler error saying that timeElapsed is not in this scope of this file, I don't know enough c++ to understand the access mechanism, can somebody point me to the right solution.
Aucun commentaire:
Enregistrer un commentaire