拓展板图片:
使用说明:
https://www.mpja.com/download/Hackatronics-Arduino-Multi-function-Shield.pdf
需要下载的库文件:
https://github.com/PaulStoffregen/TimerOne/releases/tag/1.1
[http://files.cohesivecomputing.co.uk/MultiFuncShield-Library.zip](http://files.cohesivecomputing.co.uk/MultiFuncShield-Library.zip]
在Arduino中加载库:
然后就可以使用使用说明中的代码进行测试了,
比如让LED数码管显示内容:
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
void setup() {
// put your setup code here, to run once:
Timer1.initialize();
MFS.initialize(&Timer1); // initialize multi-function shield library
MFS.write("Hi");
delay(2000);
MFS.write(-273);
delay(2000);
MFS.write(3.141, 2); // display to 2 decimal places.
delay(2000);
}
int counter=0;
byte ended = false;
void loop() {
// put your main code here, to run repeatedly:
if (counter < 200)
{
MFS.write((int)counter);
counter++;
}
else if (!ended)
{
ended = true;
MFS.write("End");
MFS.blinkDisplay(DIGIT_ALL, ON);
}
delay(50);
}
实验现象为数码管先显示hi
,然后显示-273
,接着显示3.14
,最后进行计数到200(20秒)闪烁End
字样。