Hardware Reference
In-Depth Information
* There is also a way to print current memeory for debugging
*/
ATS_PrintTestStatus("1. Test of true test status", true);
ATS_PrintTestStatus("2. Test of false test status, this will fail.", false);
ATS_ReportMemoryUsage(startMemoryUsage);
/*
* Test Run End
*/
ATS_end();
}
//************************************************************************
void loop()
{
}
Here is the test result:
info.MANUFACTURER = Arduino
info.CPU-NAME = ATmega328P
info.GCC-Version = 4.3.2
info.AVR-LibC-Ver = 1.6.4
info.Compiled-date = Oct 20 2010
info.Test-Suite-Name = Skeleton Test
info.Free-memory = 1322 bytes
1. Test of true test status ... ok
2. Test of false test status, this will fail. ... FAIL
Memory Usage ... ok
--------------------------
Ran 3 tests in 1.508s
FAILED (failures=1)
Testing Libraries
One of goals of this chapter is to make it possible to test your own libraries. In this section, we will test an Arduino
library, which can be used as a model for testing your own. We'll test the SPI library, which is used to communicate
digitally with other electronic devices, such as temperature sensors, SD cards, and EEPROM, all of which all support
the SPI protocol. To test the SPI protocol of Arduino, we can make two Arduinos talk to each other. We will connect
them as a master-and-slave device.
The tests will be from the point of view of the master and ensure that the functions defined in the library work
correctly. The tests will be part of the sketch that we load onto the master Arduino. The slave Arduino will be loaded
with a sketch that configures it in slave mode and provides a set of information that will return known data to the
master.
Figure 13-5 shows the two Arduinos configured in master-and-slave configuration. Pins 10, 11, 12, and 13 are tied
together between them. Power and ground are connected so that the slave Arduino is powered by the master.
 
Search WWH ::




Custom Search