203
Chapter 18 74HC595 & 7-segment display.
Finally, in the main function, configure all the GPIO, and set the timer function.
pinMode
(
dataPin
,
OUTPUT
);
//set the pin connected to74HC595 for output mode
pinMode
(
latchPin
,
OUTPUT
);
pinMode
(
clockPin
,
OUTPUT
);
//set the pin connected to 7-segment display common end to output mode
for
(
i
=
0
;
i
<
4
;
i
++){
pinMode
(
digitPin
[
i
],
OUTPUT
);
digitalWrite
(
digitPin
[
i
],
LOW
);
}
signal
(
SIGALRM
,
timer
);
//configure the timer
alarm
(
1
);
//set the time of timer to 1s
In the while cycle, make the digital display variable counter value. The value will change in function timer (),
so the content displayed by 7-segment display will change accordingly.
while
(
1
){
display
(
counter
);
//display number counter
}
Summary of Contents for Ultimate Starter Kit
Page 1: ...Free your innovation Freenove is an open source electronics platform www freenove com ...
Page 117: ...117 Chapter 9 Potentiometer RGBLED www freenove com support freenove com Hardware connection ...
Page 155: ...155 Chapter 14 Relay Motor www freenove com support freenove com Hardware connection OFF 3 3V ...
Page 173: ...173 Chapter 16 Stepping Motor www freenove com support freenove com Hardware connection ...
Page 239: ...239 Chapter 22 Matrix Keypad www freenove com support freenove com Circuit Schematic diagram ...
Page 240: ...Chapter 22 Matrix Keypad 240 www freenove com support freenove com Hardware connection ...