Skip to content

Commit 4a29597

Browse files
committed
determine how much memory each instance
1 parent 415a002 commit 4a29597

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test/encoder_test/encoder_test.ino

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
* the ArduinoUnit library to your Arduino/libraries/ directory.
44
* available here: https://github.com/mmurdoch/arduinounit (2.0 or greater.)
55
*/
6+
7+
//* Due to arduino issue, Wire and Servo libraries need to be included. Should be fixed in later versions
68
#include <Wire.h>
79
#include <Servo.h>
10+
//*/
811
#include <ArduinoUnit.h>
912
#include "Firmata.h"
1013
#include "utility/EncoderFirmata.h"
@@ -21,6 +24,8 @@ void setup()
2124
Serial.begin(57600); // must match port configuration
2225
}
2326

27+
28+
2429
test(attachEncoder)
2530
{
2631
EncoderFirmata encoder;
@@ -33,6 +38,17 @@ test(attachEncoder)
3338
assertTrue(encoder.isEncoderAttached(encoderNum));
3439
}
3540

41+
test(requiredMemoryPerEncoder)
42+
{
43+
assertTestPass(attachEncoder);
44+
EncoderFirmata encoder;
45+
byte encoderNum = 0, pin1 = 2, pin2 = 3;
46+
int initialMemory = freeMemory();
47+
encoder.attachEncoder(encoderNum, pin1, pin2);
48+
49+
assertTrue((initialMemory - freeMemory()) < 1 );
50+
}
51+
3652
test(handleAttachEncoderMessage)
3753
{
3854
assertTestPass(attachEncoder);

test/firmata_test/firmata_test.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* Download version 2.0 or greater.
66
*/
77

8+
//* Due to arduino issue, Wire and Servo libraries need to be included. Should be fixed in later versions
9+
#include <Wire.h>
10+
#include <Servo.h>
11+
//*/
812
#include <ArduinoUnit.h>
913
#include <Firmata.h>
1014

0 commit comments

Comments
 (0)