7/23/22, 9:39 PM
Seeeduino XIAO Expansion board - Seeed Wiki
https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/
47/66
83
colorWipe(strip.Color(
0
,
255
,
30
),
50
);
84
u8x8.setFont(u8x8_font_chroma48medium8_r);
85
u8x8.setCursor(
0
,
3
);
86
u8x8.print(
"Identity comfirm"
);
87
delay(
800
);
88
89
analogWrite(BuzzerPin,
128
);
90
delay(
100
);
91
analogWrite(BuzzerPin,
0
);
92
delay(
100
);
93
analogWrite(BuzzerPin,
128
);
94
delay(
100
);
95
analogWrite(BuzzerPin,
0
);
96
delay(
100
);
97
98
for
(pos =
0
; pos <=
90
; pos +=
1
) {
99
myservo.write(pos);
100
delay(
15
);
101
}
102
while
(
1
) {
103
// pinMode(buttonPin, INPUT);
104
buttonState = digitalRead(buttonPin);
105
u8x8.setFont(u8x8_font_chroma48medium8_r);
106
u8x8.setCursor(
0
,
3
);
107
u8x8.print(
"Please close "
);
108
Serial.println(pos);
109
Serial.println(buttonState);
110
if
(buttonState == LOW && pos ==
91
) {
111
for
(pos =
91
; pos >=
0
; pos -=
1
) {
// goes fro
112
u8x8.setFont(u8x8_font_chroma48medium8_r);
113
u8x8.setCursor(
0
,
3
);
114
u8x8.print(
"Lock closing "
);
115
myservo.write(pos);
// tell servo
116
delay(
15
);
// waits 15ms
117
}
118
colorWipe(strip.Color(
255
,
0
,
0
),
50
);
119
break
;
120
}
121
}
122
}
123