Remove apostrophes and fix a typo (#196)
This commit is contained in:
parent
cba82df30b
commit
21622fc913
@ -14,10 +14,10 @@ Our 7 Segment display has pins as follows.
|
||||
--D--
|
||||
----
|
||||
|
||||
By default we are allocating GPIO 2 to A, 3 to B etc.
|
||||
By default we are allocating GPIO 2 to segment A, 3 to B etc.
|
||||
So, connect GPIO 2 to pin A on the 7 segment LED display and so on. You will need the appropriate resistors (68 ohm should be fine) for each segment.
|
||||
The LED device used here is common anode, so the anode pin is connected to the 3.3v supply, and the GPIO's need to pull low (to ground) to complete the circuit.
|
||||
The pull direction of the GPIO's is specified in the code itself.
|
||||
The LED device used here is common anode, so the anode pin is connected to the 3.3v supply, and the GPIOs need to pull low (to ground) to complete the circuit.
|
||||
The pull direction of the GPIOs is specified in the code itself.
|
||||
|
||||
Connect the switch to connect on pressing. One side should be connected to ground, the other to GPIO 9.
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
E C
|
||||
--D--
|
||||
|
||||
By default we are allocating GPIO 2 to A, 3 to B etc.
|
||||
So, connect GOIP 2 to pin A on the 7 segment LED display etc. Don't forget
|
||||
By default we are allocating GPIO 2 to segment A, 3 to B etc.
|
||||
So, connect GPIO 2 to pin A on the 7 segment LED display etc. Don't forget
|
||||
the appropriate resistors, best to use one for each segment!
|
||||
|
||||
Connect button so that pressing the switch connects the GPIO 9 (default) to
|
||||
@ -28,7 +28,7 @@
|
||||
#define FIRST_GPIO 2
|
||||
#define BUTTON_GPIO (FIRST_GPIO+7)
|
||||
|
||||
// This array converts a number 0-9 to a bit pattern to send to the GPIO's
|
||||
// This array converts a number 0-9 to a bit pattern to send to the GPIOs
|
||||
int bits[10] = {
|
||||
0x3f, // 0
|
||||
0x06, // 1
|
||||
@ -83,7 +83,7 @@ int main() {
|
||||
// We are starting with GPIO 2, our bitmap starts at bit 0 so shift to start at 2.
|
||||
int32_t mask = bits[val] << FIRST_GPIO;
|
||||
|
||||
// Set all our GPIO's in one go!
|
||||
// Set all our GPIOs in one go!
|
||||
// If something else is using GPIO, we might want to use gpio_put_masked()
|
||||
gpio_set_mask(mask);
|
||||
sleep_ms(250);
|
||||
|
||||
Reference in New Issue
Block a user