This question have been risen again and again and I got tired to answer one and same that DuinoMite have 20 GPIOs, but people don’t stop asking.
Mainly their confusion come from the fact that they have read this misleading web page where is written that Duinomite can use only 11 out of 20 GPIOs .
These hardware “experts” keep labeling DuinoMite hardware as “cripled”, “flacky” etc and praise Maximite for the availability of 20 GPIOs not seeing the fact that DuinoMite have some SHARED functionality pins, but this do not mean that these can’t be used. They just keep parroting the written on the above page without even bother to look and understand the DuinoMite schematic
I always have told everyone the obvious from the schematic -> DuinoMite have 20 GPIOs just like the Maximite board which inspired it.
To stop the speculations today I decided to run small demo where to show that Duinomite can drive each one of it GPIOs by driving LED connected to it and at the same time to scan button connected to the same pin.
This briliant idea came to Mick Gulovsen’s mind and he shared schematic with me on KSD forum:
How does this works?
We initialize PIN(x) as OUTPUT and if we drive high and low the LED will go ON and OFF, but how do we scan the button connected to it???
The button is connected with 1K to Ground and there is 10K weak pullup to Vcc.
When the PIN is input if the button is closed it will read 0 if the button is open it will read 1. The 1K in parallel with the LED will not cause problems as the LED is powered through 150 ohm resistor which is small enough.
So I quickly made Bread board setup for it.
As you know DuinoMite have UEXT connector beside the standard Maximite GPIO 20 pin connector, our software genius Ken Segler noticed that we have on UEXT two signals which are not shared and decided to assign them PIN 22 and PIN 23 values.
Why he skipped PIN 21? Because PIN(21) was already used as Analog input to monitor Li-Po battery voltage.
So at the end unfortunately I have to admit that I really was wrong about the number of GPIOs Duinomite can drive independantly – I appologize for the mistake, they are not 20 but 22🙂
I wrote small code which chase 22 LEDs and scan for 22 buttons:
10 FOR I = 1 TO 23
20 IF I <> 21 THEN SETPIN I,8: PIN(I) = 0
30 NEXT I
40 I = 1
50 PIN(I) = 1
60 GOSUB 1000
70 PIN(I) = 0
75 GOSUB 1000
80 I = I +1
90 IF I = 21 THEN I=I+1
100 IF I < 24 THEN 50
110 I = I -1
120 PIN(I) = 1
130 GOSUB 1000
140 PIN(I) = 0
150 GOSUB 1000
160 I = I -1
170 IF I = 21 THEN I = I-1
180 IF I>0 THEN 120
190 GOTO 40
1000 FOR J = 1 TO 23
1010 IF J <> 21 THEN 1100
1030 PAUSE 10
1100 SETPIN J,2
1110 IF PIN(J) = 0 THEN 1200
1120 SETPIN J,8
1130 GOTO 1020
1200 PRINT “BUTTON “;J;” PRESSED”
1210 DO WHILE PIN(J) = 0: PAUSE 1: LOOP
1220 GOTO 1120
run it and it worked as expected, clock here to see video where the LEDs connected to the 22 GPIOs are running and buttons are scanned.
here is clearer picture showing all buttons status