1#include <MaxMatrix.h>
2int buzzer = 10;
3int smokeA0 = A5;
4int
5 sensorThres = 400;
6int DIN = 7;
7int CLK = 6;
8int CS = 5;
9int maxInUse
10 = 1;
11byte buffer[20];
12char text[] = "a";
13MaxMatrix m(DIN, CS, CLK, maxInUse);
14
15void
16 setup() {
17 pinMode(buzzer, OUTPUT);
18 pinMode(smokeA0, INPUT);
19 Serial.begin(9600);
20
21 {
22 m.init();
23 m.setIntensity(8);
24}
25}
26
27void loop() {
28 int
29 analogSensor = analogRead(smokeA0);
30
31 Serial.print("Pin A0: ");
32 Serial.println(analogSensor);
33
34
35 if (analogSensor > sensorThres)
36
37 {
38
39 tone(buzzer, 1000, 200);
40 }
41 else
42 {
43
44 noTone(buzzer);
45
46 }
47 delay(100);
48{
49 m.setDot(7, 7, true);
50 delay(300);
51 m.setDot(6,
52 6, true);
53 delay(300);
54m.setDot(5, 5, true);
55 delay(300);
56 m.setDot(4,
57 4, true);
58 delay (300);
59 m.setDot(3, 3, true);
60 delay(300);
61 m.setDot(2,
62 2, true);
63 delay(300);
64 m.setDot(1, 1, true);
65 delay(300);
66 m.setDot(0,
67 0, true);
68 delay(300);
69 m.setDot(0, 7, true);
70 delay(300);
71 m.setDot(1,
72 6, true);
73 delay(300);
74 m.setDot(2, 5, true);
75 delay(300);
76 m.setDot(3,
77 4, true);
78 delay(300);
79 m.setDot(4, 3, true);
80 delay(300);
81 m.setDot(5,
82 2, true);
83 delay(300);
84 m.setDot(6, 1, true);
85 delay(300);
86 m.setDot(7,
87 0, true);
88 delay(300);
89
90
91 m.clear();
92 delay(1000);}
93}
94