Lance-Rocket : Différence entre versions

Ligne 39 : Ligne 39 :
 
code source :  
 
code source :  
  
from machine import Pin, I2C
+
''from machine import Pin, I2C''
  
import ssd1306
+
''import ssd1306''
  
<nowiki>#</nowiki> ESP32 Pin assignment
+
''<nowiki>#</nowiki> ESP32 Pin assignment''
  
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
+
''i2c = I2C(0, scl=Pin(22), sda=Pin(21))''
  
oled_width = 128
+
''oled_width = 128''
  
oled_height = 64
+
''oled_height = 64''
  
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
+
''oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)''
  
     
+
''     ''
  
boutonR=Pin(15,Pin.IN)
+
''boutonR=Pin(15,Pin.IN)''
  
bouton1=Pin(4,Pin.IN)
+
''bouton1=Pin(4,Pin.IN)''
  
bouton2=Pin(5,Pin.IN)
+
''bouton2=Pin(5,Pin.IN)''
  
bouton3=Pin(14,Pin.IN)
+
''bouton3=Pin(14,Pin.IN)''
  
compteur =0
+
''compteur =0''
  
message= <nowiki>''</nowiki>
+
''message= <nowiki>''</nowiki>''
  
appuyerbouton1 = 0
+
''appuyerbouton1 = 0''
  
appuyerbouton2 = 0
+
''appuyerbouton2 = 0''
  
appuyerbouton3 = 0
+
''appuyerbouton3 = 0''
  
appuyerboutonR = 0
+
''appuyerboutonR = 0''
  
while True:
+
''while True:''
  
    if boutonR.value() == 0 and appuyerboutonR == 0:
+
''    if boutonR.value() == 0 and appuyerboutonR == 0:''
  
        appuyerboutonR = 1
+
''        appuyerboutonR = 1''
  
       
+
''       ''
  
    elif boutonR.value() == 1 and appuyerboutonR == 1 :
+
''    elif boutonR.value() == 1 and appuyerboutonR == 1 :''
  
        appuyerboutonR = 0
+
''        appuyerboutonR = 0''
  
        compteur = 0
+
''        compteur = 0''
  
       
+
''       ''
  
       
+
''       ''
  
    if bouton1.value() == 0 and appuyerbouton1 == 0:
+
''    if bouton1.value() == 0 and appuyerbouton1 == 0:''
  
        appuyerbouton1 = 1
+
''        appuyerbouton1 = 1''
  
       
+
''       ''
  
    elif bouton1.value() == 1 and appuyerbouton1 == 1 :
+
''    elif bouton1.value() == 1 and appuyerbouton1 == 1 :''
  
        appuyerbouton1 = 0
+
''        appuyerbouton1 = 0''
  
        compteur = compteur +1
+
''        compteur = compteur +1''
  
       
+
''       ''
  
       
+
''       ''
  
    if bouton2.value() == 0 and appuyerbouton2 == 0:
+
''    if bouton2.value() == 0 and appuyerbouton2 == 0:''
  
        appuyerbouton2 = 1
+
''        appuyerbouton2 = 1''
  
       
+
''       ''
  
    elif bouton2.value() == 1 and appuyerbouton2 == 1 :
+
''    elif bouton2.value() == 1 and appuyerbouton2 == 1 :''
  
        appuyerbouton2 = 0
+
''        appuyerbouton2 = 0''
  
        compteur = compteur +1
+
''        compteur = compteur +1''
  
       
+
''       ''
  
       
+
''       ''
  
   
+
''   ''
  
    if bouton3.value() == 0 and appuyerbouton3 == 0:
+
''    if bouton3.value() == 0 and appuyerbouton3 == 0:''
  
        appuyerbouton3 = 1
+
''        appuyerbouton3 = 1''
  
       
+
''       ''
  
    elif bouton3.value() == 1 and appuyerbouton3 == 1 :
+
''    elif bouton3.value() == 1 and appuyerbouton3 == 1 :''
  
        appuyerbouton3 = 0
+
''        appuyerbouton3 = 0''
  
        compteur = compteur +1
+
''        compteur = compteur +1''
  
    message= 'score '+ str(compteur)
+
''    message= 'score '+ str(compteur)''
  
    oled.fill(0)
+
''    oled.fill(0)''
  
    oled.text(message, 10, 30)
+
''    oled.text(message, 10, 30)''
  
    oled.show()</translate>
+
''    oled.show()''</translate>
 
|Step_Picture_00=Lance-Rocket_Capture_d_cran_2023-04-13_165010.png
 
|Step_Picture_00=Lance-Rocket_Capture_d_cran_2023-04-13_165010.png
 
}}
 
}}

Version du 13 avril 2023 à 17:06

Auteur avatarM.Lance-Rocket | Dernière modification 18/04/2023 par M.Lance-Rocket

Pas encore d'image

Vous réaliserez un lance-rocket bien évidemment dans un cadre pédagogique et non dans le but de blessé qui que ce soit.

Introduction

Voici le tuto pour réaliser votre propre "Lance-Rocket" éducatif.

Matériaux

Outils

Étape 1 - Modéliser le socle qui accueillera le canon

Modélisation sur solidworks




Étape 2 - Modéliser les cibles

Modélisation sur solidworks




Étape 3 - Graver nos modélisations

Grâce à une graveuse laser nous découpons nos modélisations sur du bois.

Étape 4 - création programme

on a fait un premier test sur le site Wokwi puis nous avant effectué le montage

code source :

from machine import Pin, I2C

import ssd1306

# ESP32 Pin assignment

i2c = I2C(0, scl=Pin(22), sda=Pin(21))

oled_width = 128

oled_height = 64

oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)

     

boutonR=Pin(15,Pin.IN)

bouton1=Pin(4,Pin.IN)

bouton2=Pin(5,Pin.IN)

bouton3=Pin(14,Pin.IN)

compteur =0

message= ''

appuyerbouton1 = 0

appuyerbouton2 = 0

appuyerbouton3 = 0

appuyerboutonR = 0

while True:

    if boutonR.value() == 0 and appuyerboutonR == 0:

        appuyerboutonR = 1

       

    elif boutonR.value() == 1 and appuyerboutonR == 1 :

        appuyerboutonR = 0

        compteur = 0

       

       

    if bouton1.value() == 0 and appuyerbouton1 == 0:

        appuyerbouton1 = 1

       

    elif bouton1.value() == 1 and appuyerbouton1 == 1 :

        appuyerbouton1 = 0

        compteur = compteur +1

       

       

    if bouton2.value() == 0 and appuyerbouton2 == 0:

        appuyerbouton2 = 1

       

    elif bouton2.value() == 1 and appuyerbouton2 == 1 :

        appuyerbouton2 = 0

        compteur = compteur +1

       

       

   

    if bouton3.value() == 0 and appuyerbouton3 == 0:

        appuyerbouton3 = 1

       

    elif bouton3.value() == 1 and appuyerbouton3 == 1 :

        appuyerbouton3 = 0

        compteur = compteur +1

    message= 'score '+ str(compteur)

    oled.fill(0)

    oled.text(message, 10, 30)

    oled.show()




Étape 5 - Création du support canon

nous avons crée un support pour le canon avec un roulement a bille pour amélioré la fluidité




Commentaires

Draft