Étape 1: Comment connecter un capteur pir.
Nécessaire :
capteur pir 5V Veillez et vérifiez que la goupille de découpes car tous ne sont pas les mêmes. (La nôtre était une 276-0033 R/S aka parallaxe 555-28027)
Utilisez http://www.ladyada.net/learn/sensors/pir.html comme guide pour tester votre capteur.
NPN transistor 2n2222 ou 2n3904.
Relais de 5 volts.
résistance à 10 k ohm.
diodes 1N4002.
Fil.
Remarque la quatrième photo est pour ceux qui aiment un peu plus de sécurité dans le circuit.
--------------------------------------------------------------------------------------
Exemple de code :
getpirdata :
r = STRIG(2)
SELECT CASE r
CAS -1
drapeau = 1
CASE 0
drapeau = 2
CASE ELSE
GOSUB errornotice
END SELECT
RETOUR
--------------------------------------------------------------------------------------
Joystick B ____ Joystick A / | / | / | / 1 | | O------- 5 Volt 5 Volt -------O | | 9 2 | | O------- Button 1 Button 3 -------O | | 10 3 | | O------- Resistor X-axis (joystick(1)) Resistor X-axis -------O | (joystick(2)) | 11 4 | | O------- Ground MIDI TXD -------O | | 12 5 | | O------- Ground Resistor Y-axis -------O | (joystick(2)) | 13 6 | | O------- Resistor Y-axis (joystick(1)) Button 4 -------O | | 14 7 | | O------- Button 2 MIDI RXD -------O | | 15 8 | | O------- 5 Volt \ | \ | \ | \ | \__| Digital pin 2 = Button 1 = Strig(0) pin 7 = Button 2 = Strig(1) pin 10 = Button 3 = Strig(2) pin 14 = Button 4 = Strig(3)
Analog
broche 3 = résistance = Stick(0)
broche 6 = résistance = Stick(1)
broche 11 = résistance = Stick(2)
broche 13 = résistance = Stick(3)