IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Déploiement/Installation Python Discussion :

wordclock diy en python et Raspberry


Sujet :

Déploiement/Installation Python

  1. #61
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    aie..... probleme :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    Press Ctrl-C to quit.
    Use "-c" argument to clear LEDs on exit
    IL EST SEPT HEURES TRENTE CINQ . .
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    PIN17
    IL EST SEPT HEURES TRENTE CINQ . . . .
    [100, 101, 103, 104, 105, 85, 86, 87, 88, 50, 49, 48, 47, 46, 45, 12, 13, 14, 15, 16, 17, 5, 4, 3, 2, 111, 114, 113, 112]
    IL EST SEPT HEURES TRENTE CINQ . . . .
    Traceback (most recent call last):
      File "wordclock.py", line 146, in <module>
        showArray(strip, get_color(), convert(*getHour()))
      File "wordclock.py", line 102, in showArray
        strip.setPixelColor(i, color if (i+1) in array else Color(0,0,0))
      File "/home/pi/piLedClock/rpi_ws281x/python/neopixel.py", line 118, in setPixelColor
        self._led_data[n] = color
      File "/home/pi/piLedClock/rpi_ws281x/python/neopixel.py", line 49, in __setitem__
        return ws.ws2811_led_set(self.channel, pos, value)
    OverflowError: in method 'ws2811_led_set', argument 3 of type 'uint32_t'
    j'ai atendu 2 minutes pour rallumer mais erreur avant de pouvoir rallumer... :-(

  2. #62
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    le traceback indique ligne 146, mais moi j'ai rien ligne 146, donc on n'a pas le même code toi et moi.
    paste l'intégralité de ton code, même les lignes où y a rien, tel qu'il apparaît dans ton éditeur.

  3. #63
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par josmiley Voir le message
    le traceback indique ligne 146, mais moi j'ai rien ligne 146, donc on n'a pas le même code toi et moi.
    paste l'intégralité de ton code, même les lignes où y a rien, tel qu'il apparaît dans ton éditeur.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    #a lancer avec cd piLedClock/rpi_ws281x/python
    #et sudo python3 wordclock.py
    from datetime import datetime
    from time import sleep
    from neopixel import *
    import argparse
    import RPi.GPIO as GPIO                 #bibliothèque RPi.GPIO
    import time                             #bibliothèque time
     
    # LED strip configuration:
    LED_COUNT      = 114      # Number of LED pixels.
    LED_PIN        = 18      # GPIO pin connected to the pixels (18 uses PWM!).
    #LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
    LED_FREQ_HZ    = 800000  # LED signal frequency in hertz (usually 800khz)
    LED_DMA        = 10      # DMA channel to use for generating signal (try 10)
    LED_BRIGHTNESS = 255     # Set to 0 for darkest and 255 for brightest
    LED_INVERT     = False   # True to invert the signal (when using NPN transistor level shift)
    LED_CHANNEL    = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53
    #-------------------------------------------------------------------------------
    pin = 17, 22, 24                                        #broche utilisé en entrée
    #temps = 1                                              #valeur attente en msec
    #temps = 10
    temps = 100
    #temps = 100
    #temps = 1000
    GPIO.setwarnings(False)                                 #désactive le mode warning
    GPIO.setmode(GPIO.BCM)                                  #utilisation des numéros de ports du
                                                            #processeur
    GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
                                                            #mise en entrée du port GPIO 22
                                                            #et activation résistance soutirage
                                                            #au ground
     
     
    panel    = \
    "\
    ILNESTODEUX\
    QUATRETROIS\
    NEUFUNESEPT\
    HUITSIXCINQ\
    MIDIXMINUIT\
    ONZERHEURES\
    MOINSOLEDIX\
    ETRQUARTPMD\
    TRENTEOURXT\
    VINGT-CINQU\
    ....\
    "
     
     
    # stripLettre est la liste des LEDs en fonction de l'ordre des lettres dans panel
    # tient compte du tortillement du ruban
    stripLettre = list(range(110,0,-1))
    for i in range(0,110,22): stripLettre[i:i+11] = stripLettre[i:i+11][::-1]
    stripDot    = [111, 114, 113, 112]
    stripLettre += stripDot
     
     
    def convert(heure,minute):
        """convertit l'heure en texte, recherche chaque terme dans le panel,
        et utilise l'index des mots pour extraire dans stripLettre les numéros des leds à allumer"""
     
        heure   = (heure+(minute>=35))%24
        liaison = heure%12>1 and'HEURES'or heure%12 and'HEURE'or''
        heure   = (heure//12 and'MIDI'or'MINUIT','UNE','DEUX','TROIS','QUATRE','CINQ','SIX','SEPT','HUIT','NEUF','DIX','ONZE')[heure%12]
        dot     = ' . . . .'[:minute%5*2]
        minute  = ('','CINQ','DIX','ET QUART','VINGT','VINGT-CINQ','TRENTE','TRENTE CINQ','MOINS VINGT','MOINS LE QUART','MOINS DIX','MOINS CINQ')[minute//5]
        litt    = f'IL EST {heure}'
        if liaison: litt = litt + ' ' + liaison
        if minute : litt = litt + ' ' + minute
        litt += dot
        print(litt)
        output  = []
        index   = 0
        for mot in litt.split():
            i = panel.find(mot,index)
            output.extend(stripLettre[i:i+len(mot)])
            index = i + len(mot)
        return output
     
     
    def getHour():
     
        maintenant = datetime.now()
        heure      = maintenant.hour
        minute     = maintenant.minute
        return heure,minute
     
     
    # Define functions which animate LEDs in various ways.
    def colorWipe(strip, color, wait_ms=50):
        """Wipe color across display a pixel at a time."""
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color)
            strip.show()
            sleep(wait_ms/1000.0)
     
    #Show array
    def showArray(strip, color, array):
        array = set(array)
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color if (i+1) in array else Color(0,0,0))
        strip.show() 
     
     
    def get_color():
        R,G,B = list_color[index_color]
        return Color(int(R*current_bright),int(G*current_bright),int(B*current_bright))
     
    list_color      = [(253, 51, 100), (138, 36, 177), (240, 120, 228), (129, 77, 86), (111, 147, 168), (221, 254, 42), (152, 216, 39), (166, 165, 158), (144, 44, 102), (236, 25, 252)]
    index_color     = 0
    current_bright  = 1
     
     
    delay_low       = 0
     
    pin17state      = True
     
    if __name__ == '__main__':
        # Process arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
        args = parser.parse_args()
     
        # Create NeoPixel object with appropriate configuration.
        strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
        # Intialize the library (must be called once before other functions).
        strip.begin()
     
        print ('Press Ctrl-C to quit.')
        if not args.clear:
            print('Use "-c" argument to clear LEDs on exit')
     
        # attendre si on est moins d'une seconde de la minute suivante
        while datetime.now().second == 59: continue
        showArray(strip, get_color(), convert(*getHour()))
     
        try:
            while True:
     
     
                if datetime.now().second == 0:
     
                    output = convert(*getHour())
                    print(output)
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin17 = GPIO.input(17)
                if (entreepin17 == True) and not pin17state:
                    pin17state = True
                    delay_low = 0
                    current_bright = round((current_bright+.1)%1.1,1) or .1
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin17 == False):
                    pin17state = False
                    print ('PIN17')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    colorWipe(strip, Color(0,0,0), 10)
                    current_bright = round((current_bright-.1),1)
                    while not GPIO.input(17): pass
                    pin17state = True
     
                entreepin22 = GPIO.input(22)
                if (entreepin22 == False):
                    print ('PIN22')
                    index_color = (index_color+1)%len(list_color)
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin24 = GPIO.input(24)
                if (entreepin24 == False):
                    print ('PIN24') 
                    # met à jour au cas de dépassement de minute
                    showArray(strip, Color(50,50,50), convert(*getHour()))
                time.sleep(temps / 1000)
     
        except KeyboardInterrupt:
                if args.clear:
                     colorWipe(strip, Color(0,0,0), 10)

  4. #64
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    ouais, j'ai pas la même chose ...

    essayes ça:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    #a lancer avec cd piLedClock/rpi_ws281x/python
    #et sudo python3 wordclock.py
    from datetime import datetime
    from time import sleep
    from neopixel import *
    import argparse
    import RPi.GPIO as GPIO                 #bibliothèque RPi.GPIO
    import time                             #bibliothèque time
     
    # LED strip configuration:
    LED_COUNT      = 114      # Number of LED pixels.
    LED_PIN        = 18      # GPIO pin connected to the pixels (18 uses PWM!).
    #LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
    LED_FREQ_HZ    = 800000  # LED signal frequency in hertz (usually 800khz)
    LED_DMA        = 10      # DMA channel to use for generating signal (try 10)
    LED_BRIGHTNESS = 255     # Set to 0 for darkest and 255 for brightest
    LED_INVERT     = False   # True to invert the signal (when using NPN transistor level shift)
    LED_CHANNEL    = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53
    #-------------------------------------------------------------------------------
    pin = 17, 22, 24                                        #broche utilisé en entrée
    #temps = 1                                              #valeur attente en msec
    #temps = 10
    temps = 100
    #temps = 100
    #temps = 1000
    GPIO.setwarnings(False)                                 #désactive le mode warning
    GPIO.setmode(GPIO.BCM)                                  #utilisation des numéros de ports du
                                                            #processeur
    GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
                                                            #mise en entrée du port GPIO 22
                                                            #et activation résistance soutirage
                                                            #au ground
     
     
    panel    = \
    "\
    ILNESTODEUX\
    QUATRETROIS\
    NEUFUNESEPT\
    HUITSIXCINQ\
    MIDIXMINUIT\
    ONZERHEURES\
    MOINSOLEDIX\
    ETRQUARTPMD\
    TRENTEOURXT\
    VINGT-CINQU\
    ....\
    "
     
     
    # stripLettre est la liste des LEDs en fonction de l'ordre des lettres dans panel
    # tient compte du tortillement du ruban
    stripLettre = list(range(110,0,-1))
    for i in range(0,110,22): stripLettre[i:i+11] = stripLettre[i:i+11][::-1]
    stripDot    = [111, 114, 113, 112]
    stripLettre += stripDot
     
     
    def convert(heure,minute):
        """convertit l'heure en texte, recherche chaque terme dans le panel,
        et utilise l'index des mots pour extraire dans stripLettre les numéros des leds à allumer"""
     
        heure   = (heure+(minute>=35))%24
        liaison = heure%12>1 and'HEURES'or heure%12 and'HEURE'or''
        heure   = (heure//12 and'MIDI'or'MINUIT','UNE','DEUX','TROIS','QUATRE','CINQ','SIX','SEPT','HUIT','NEUF','DIX','ONZE')[heure%12]
        dot     = ' . . . .'[:minute%5*2]
        minute  = ('','CINQ','DIX','ET QUART','VINGT','VINGT-CINQ','TRENTE','TRENTE CINQ','MOINS VINGT','MOINS LE QUART','MOINS DIX','MOINS CINQ')[minute//5]
        litt    = f'IL EST {heure}'
        if liaison: litt = litt + ' ' + liaison
        if minute : litt = litt + ' ' + minute
        litt += dot
        print(litt)
        output  = []
        index   = 0
        for mot in litt.split():
            i = panel.find(mot,index)
            output.extend(stripLettre[i:i+len(mot)])
            index = i + len(mot)
        return output
     
     
    def getHour():
     
        maintenant = datetime.now()
        heure      = maintenant.hour
        minute     = maintenant.minute
        return heure,minute
     
     
    # Define functions which animate LEDs in various ways.
    def colorWipe(strip, color, wait_ms=50):
        """Wipe color across display a pixel at a time."""
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color)
            strip.show()
            sleep(wait_ms/1000.0)
     
    #Show array
    def showArray(strip, color, array):
        array = set(array)
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color if (i+1) in array else Color(0,0,0))
        strip.show() 
     
     
    def get_color():
        R,G,B = list_color[index_color]
        return Color(int(R*current_bright),int(G*current_bright),int(B*current_bright))
     
    list_color      = [(253, 51, 100), (138, 36, 177), (240, 120, 228), (129, 77, 86), (111, 147, 168), (221, 254, 42), (152, 216, 39), (166, 165, 158), (144, 44, 102), (236, 25, 252)]
    index_color     = 0
    current_bright  = 1
     
    delay_low       = 0
     
    pin17state      = True
     
    if __name__ == '__main__':
        # Process arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
        args = parser.parse_args()
     
        # Create NeoPixel object with appropriate configuration.
        strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
        # Intialize the library (must be called once before other functions).
        strip.begin()
     
        print ('Press Ctrl-C to quit.')
        if not args.clear:
            print('Use "-c" argument to clear LEDs on exit')
     
        # attendre si on est moins d'une seconde de la minute suivante
        while datetime.now().second == 59: continue
        showArray(strip, get_color(), convert(*getHour()))
     
        try:
            while True:
     
     
                if datetime.now().second == 0:
     
                    output = convert(*getHour())
                    print(output)
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin17 = GPIO.input(17)
                if (entreepin17 == True) and not pin17state:
                    pin17state = True
                    delay_low = 0
                    current_bright = round((current_bright+.1)%1.1,1) or .1
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin17 == False):
                    pin17state = False
                    print ('PIN17')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    colorWipe(strip, Color(0,0,0), 10)
                    current_bright = round((current_bright-.1),1)
                    while not GPIO.input(17): pass
                    time.sleep(temps / 1000) # anti rebond
                    while GPIO.input(17): pass
     
                entreepin22 = GPIO.input(22)
                if (entreepin22 == False):
                    print ('PIN22')
                    index_color = (index_color+1)%len(list_color)
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin24 = GPIO.input(24)
                if (entreepin24 == False):
                    print ('PIN24') 
                    # met à jour au cas de dépassement de minute
                    showArray(strip, Color(50,50,50), convert(*getHour()))
                time.sleep(temps / 1000)
     
        except KeyboardInterrupt:
                if args.clear:
                     colorWipe(strip, Color(0,0,0), 10)

  5. #65
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    ça fonctionne! en poussant 2 sec l'horloge s'eteind et après avoir patienté 1 minute et un appui bref, elle se rallume! NICKEL!
    en ce moment le 3éme bouton sert a ramener au blanc... du coup je me dis que :
    sur le même principe que pour l'extinction on pourrait faire un appui long sur le bouton couleur pour le ramener au blanc.
    sur le bouton libre du coup ce serait jouable d'afficher un logo en fonction de la meteo? ça me parait ultra chaud mais sinon lancer un effet du strandtest m'iraît aussi bien...
    Tiens..... ce serait possible d'intégrer un effet du strandtest uniquement sur les led allumées (genre intégrer un effet au niveau du list_color = ?

  6. #66
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    cool

    déjà pour le reset de la couleur:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    if __name__ == '__main__':
        # Process arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
        args = parser.parse_args()
     
        # Create NeoPixel object with appropriate configuration.
        strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
        # Intialize the library (must be called once before other functions).
        strip.begin()
     
        print ('Press Ctrl-C to quit.')
        if not args.clear:
            print('Use "-c" argument to clear LEDs on exit')
     
        # attendre si on est moins d'une seconde de la minute suivante
        while datetime.now().second == 59: continue
        showArray(strip, get_color(), convert(*getHour()))
     
        try:
            while True:
     
     
                if datetime.now().second == 0:
     
                    output = convert(*getHour())
                    print(output)
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin17 = GPIO.input(17)
                if (entreepin17 == True) and not pin17state:
                    pin17state = True
                    delay_low = 0
                    current_bright = round((current_bright+.1)%1.1,1) or .1
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin17 == False):
                    pin17state = False
                    print ('PIN17')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    colorWipe(strip, Color(0,0,0), 10)
                    current_bright = round((current_bright-.1),1)
                    while not GPIO.input(17): pass
                    time.sleep(temps / 1000) # anti rebond
                    while GPIO.input(17): time.sleep(temps / 1000)
                    showArray(strip, get_color(), convert(*getHour()))
     
     
     
                entreepin22 = GPIO.input(22)
                if (entreepin22 == True) and not pin22state:
                    pin22state = True
                    delay_low = 0
                    index_color = (index_color+1)%len(list_color)
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin22 == False):
                    pin22state = False
                    print ('PIN22')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    index_color     = 0
                    showArray(strip, get_color(), convert(*getHour()))
                    while not GPIO.input(22): pass
                    pin22state = True
                    showArray(strip, get_color(), convert(*getHour()))
     
     
                entreepin24 = GPIO.input(24)
                if (entreepin24 == False):
                    print ('PIN24') 
                    # met à jour au cas de dépassement de minute
                    showArray(strip, Color(50,50,50), convert(*getHour()))
                time.sleep(temps / 1000)
     
        except KeyboardInterrupt:
                if args.clear:
                     colorWipe(strip, Color(0,0,0), 10)

    Après .. c'est quoi un strandtest ?

  7. #67
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par josmiley Voir le message
    cool
    Après .. c'est quoi un strandtest ?
    c'est ça :

    en gros pour tester les led, on installe la bibliothèque neopixel et il y a un fichier d'exemple avec toute sorte d'animations de led dessus...
    je teste ton code de suite
    edit :
    le traceback me renvoie ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Traceback (most recent call last):
      File "wordclock.py", line 169, in <module>
        if (entreepin22 == True) and not pin22state:
    NameError: name 'pin22state' is not defined

  8. #68
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    oui, j'ai oublié de coller une partie du code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    #a lancer avec cd piLedClock/rpi_ws281x/python
    #et sudo python3 wordclock.py
    from datetime import datetime
    from time import sleep
    from neopixel import *
    import argparse
    import RPi.GPIO as GPIO                 #bibliothèque RPi.GPIO
    import time                             #bibliothèque time
     
    # LED strip configuration:
    LED_COUNT      = 114      # Number of LED pixels.
    LED_PIN        = 18      # GPIO pin connected to the pixels (18 uses PWM!).
    #LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
    LED_FREQ_HZ    = 800000  # LED signal frequency in hertz (usually 800khz)
    LED_DMA        = 10      # DMA channel to use for generating signal (try 10)
    LED_BRIGHTNESS = 255     # Set to 0 for darkest and 255 for brightest
    LED_INVERT     = False   # True to invert the signal (when using NPN transistor level shift)
    LED_CHANNEL    = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53
    #-------------------------------------------------------------------------------
    pin = 17, 22, 24                                        #broche utilisé en entrée
    #temps = 1                                              #valeur attente en msec
    #temps = 10
    temps = 100
    #temps = 100
    #temps = 1000
    GPIO.setwarnings(False)                                 #désactive le mode warning
    GPIO.setmode(GPIO.BCM)                                  #utilisation des numéros de ports du
                                                            #processeur
    GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
                                                            #mise en entrée du port GPIO 22
                                                            #et activation résistance soutirage
                                                            #au ground
     
     
    panel    = \
    "\
    ILNESTODEUX\
    QUATRETROIS\
    NEUFUNESEPT\
    HUITSIXCINQ\
    MIDIXMINUIT\
    ONZERHEURES\
    MOINSOLEDIX\
    ETRQUARTPMD\
    TRENTEOURXT\
    VINGT-CINQU\
    ....\
    "
     
     
    # stripLettre est la liste des LEDs en fonction de l'ordre des lettres dans panel
    # tient compte du tortillement du ruban
    stripLettre = list(range(110,0,-1))
    for i in range(0,110,22): stripLettre[i:i+11] = stripLettre[i:i+11][::-1]
    stripDot    = [111, 114, 113, 112]
    stripLettre += stripDot
     
     
    def convert(heure,minute):
        """convertit l'heure en texte, recherche chaque terme dans le panel,
        et utilise l'index des mots pour extraire dans stripLettre les numéros des leds à allumer"""
     
        heure   = (heure+(minute>=35))%24
        liaison = heure%12>1 and'HEURES'or heure%12 and'HEURE'or''
        heure   = (heure//12 and'MIDI'or'MINUIT','UNE','DEUX','TROIS','QUATRE','CINQ','SIX','SEPT','HUIT','NEUF','DIX','ONZE')[heure%12]
        dot     = ' . . . .'[:minute%5*2]
        minute  = ('','CINQ','DIX','ET QUART','VINGT','VINGT-CINQ','TRENTE','TRENTE CINQ','MOINS VINGT','MOINS LE QUART','MOINS DIX','MOINS CINQ')[minute//5]
        litt    = f'IL EST {heure}'
        if liaison: litt = litt + ' ' + liaison
        if minute : litt = litt + ' ' + minute
        litt += dot
        print(litt)
        output  = []
        index   = 0
        for mot in litt.split():
            i = panel.find(mot,index)
            output.extend(stripLettre[i:i+len(mot)])
            index = i + len(mot)
        return output
     
     
    def getHour():
     
        maintenant = datetime.now()
        heure      = maintenant.hour
        minute     = maintenant.minute
        return heure,minute
     
     
    # Define functions which animate LEDs in various ways.
    def colorWipe(strip, color, wait_ms=50):
        """Wipe color across display a pixel at a time."""
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color)
            strip.show()
            sleep(wait_ms/1000.0)
     
    #Show array
    def showArray(strip, color, array):
        array = set(array)
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color if (i+1) in array else Color(0,0,0))
        strip.show() 
     
     
    def get_color():
        R,G,B = list_color[index_color]
        return Color(int(R*current_bright),int(G*current_bright),int(B*current_bright))
     
    list_color      = [(255,255,255),(253, 51, 100), (138, 36, 177), (240, 120, 228), (129, 77, 86), (111, 147, 168), (221, 254, 42), (152, 216, 39), (166, 165, 158), (144, 44, 102), (236, 25, 252)]
    index_color     = 0
    current_bright  = 1
     
    delay_low       = 0
     
    pin17state      = True
    pin22state      = True
     
    if __name__ == '__main__':
        # Process arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
        args = parser.parse_args()
     
        # Create NeoPixel object with appropriate configuration.
        strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
        # Intialize the library (must be called once before other functions).
        strip.begin()
     
        print ('Press Ctrl-C to quit.')
        if not args.clear:
            print('Use "-c" argument to clear LEDs on exit')
     
        # attendre si on est moins d'une seconde de la minute suivante
        while datetime.now().second == 59: continue
        showArray(strip, get_color(), convert(*getHour()))
     
        try:
            while True:
     
     
                if datetime.now().second == 0:
     
                    output = convert(*getHour())
                    print(output)
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin17 = GPIO.input(17)
                if (entreepin17 == True) and not pin17state:
                    pin17state = True
                    delay_low = 0
                    current_bright = round((current_bright+.1)%1.1,1) or .1
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin17 == False):
                    pin17state = False
                    print ('PIN17')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    colorWipe(strip, Color(0,0,0), 10)
                    current_bright = round((current_bright-.1),1)
                    while not GPIO.input(17): pass
                    time.sleep(temps / 1000) # anti rebond
                    while GPIO.input(17): time.sleep(temps / 1000)
                    showArray(strip, get_color(), convert(*getHour()))
     
     
     
                entreepin22 = GPIO.input(22)
                if (entreepin22 == True) and not pin22state:
                    pin22state = True
                    delay_low = 0
                    index_color = (index_color+1)%len(list_color)
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin22 == False):
                    pin22state = False
                    print ('PIN22')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    index_color     = 0
                    showArray(strip, get_color(), convert(*getHour()))
                    while not GPIO.input(22): pass
                    pin22state = True
                    showArray(strip, get_color(), convert(*getHour()))
     
     
                entreepin24 = GPIO.input(24)
                if (entreepin24 == False):
                    print ('PIN24') 
                    # met à jour au cas de dépassement de minute
                    showArray(strip, Color(50,50,50), convert(*getHour()))
                time.sleep(temps / 1000)
     
        except KeyboardInterrupt:
                if args.clear:
                     colorWipe(strip, Color(0,0,0), 10)

  9. #69
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    hum... du coup le bouton pin22 éteind de la meme manière l'horloge

  10. #70
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    arf, oublié de remettre le compteur à zéro ... voilà:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    #a lancer avec cd piLedClock/rpi_ws281x/python
    #et sudo python3 wordclock.py
    from datetime import datetime
    from time import sleep
    from neopixel import *
    import argparse
    import RPi.GPIO as GPIO                 #bibliothèque RPi.GPIO
    import time                             #bibliothèque time
     
    # LED strip configuration:
    LED_COUNT      = 114      # Number of LED pixels.
    LED_PIN        = 18      # GPIO pin connected to the pixels (18 uses PWM!).
    #LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
    LED_FREQ_HZ    = 800000  # LED signal frequency in hertz (usually 800khz)
    LED_DMA        = 10      # DMA channel to use for generating signal (try 10)
    LED_BRIGHTNESS = 255     # Set to 0 for darkest and 255 for brightest
    LED_INVERT     = False   # True to invert the signal (when using NPN transistor level shift)
    LED_CHANNEL    = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53
    #-------------------------------------------------------------------------------
    pin = 17, 22, 24                                        #broche utilisé en entrée
    #temps = 1                                              #valeur attente en msec
    #temps = 10
    temps = 100
    #temps = 100
    #temps = 1000
    GPIO.setwarnings(False)                                 #désactive le mode warning
    GPIO.setmode(GPIO.BCM)                                  #utilisation des numéros de ports du
                                                            #processeur
    GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
                                                            #mise en entrée du port GPIO 22
                                                            #et activation résistance soutirage
                                                            #au ground
     
     
    panel    = \
    "\
    ILNESTODEUX\
    QUATRETROIS\
    NEUFUNESEPT\
    HUITSIXCINQ\
    MIDIXMINUIT\
    ONZERHEURES\
    MOINSOLEDIX\
    ETRQUARTPMD\
    TRENTEOURXT\
    VINGT-CINQU\
    ....\
    "
     
     
    # stripLettre est la liste des LEDs en fonction de l'ordre des lettres dans panel
    # tient compte du tortillement du ruban
    stripLettre = list(range(110,0,-1))
    for i in range(0,110,22): stripLettre[i:i+11] = stripLettre[i:i+11][::-1]
    stripDot    = [111, 114, 113, 112]
    stripLettre += stripDot
     
     
    def convert(heure,minute):
        """convertit l'heure en texte, recherche chaque terme dans le panel,
        et utilise l'index des mots pour extraire dans stripLettre les numéros des leds à allumer"""
     
        heure   = (heure+(minute>=35))%24
        liaison = heure%12>1 and'HEURES'or heure%12 and'HEURE'or''
        heure   = (heure//12 and'MIDI'or'MINUIT','UNE','DEUX','TROIS','QUATRE','CINQ','SIX','SEPT','HUIT','NEUF','DIX','ONZE')[heure%12]
        dot     = ' . . . .'[:minute%5*2]
        minute  = ('','CINQ','DIX','ET QUART','VINGT','VINGT-CINQ','TRENTE','TRENTE CINQ','MOINS VINGT','MOINS LE QUART','MOINS DIX','MOINS CINQ')[minute//5]
        litt    = f'IL EST {heure}'
        if liaison: litt = litt + ' ' + liaison
        if minute : litt = litt + ' ' + minute
        litt += dot
        print(litt)
        output  = []
        index   = 0
        for mot in litt.split():
            i = panel.find(mot,index)
            output.extend(stripLettre[i:i+len(mot)])
            index = i + len(mot)
        return output
     
     
    def getHour():
     
        maintenant = datetime.now()
        heure      = maintenant.hour
        minute     = maintenant.minute
        return heure,minute
     
     
    # Define functions which animate LEDs in various ways.
    def colorWipe(strip, color, wait_ms=50):
        """Wipe color across display a pixel at a time."""
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color)
            strip.show()
            sleep(wait_ms/1000.0)
     
    #Show array
    def showArray(strip, color, array):
        array = set(array)
        for i in range(strip.numPixels()):
            strip.setPixelColor(i, color if (i+1) in array else Color(0,0,0))
        strip.show() 
     
     
    def get_color():
        R,G,B = list_color[index_color]
        return Color(int(R*current_bright),int(G*current_bright),int(B*current_bright))
     
    list_color      = [(255,255,255),(253, 51, 100), (138, 36, 177), (240, 120, 228), (129, 77, 86), (111, 147, 168), (221, 254, 42), (152, 216, 39), (166, 165, 158), (144, 44, 102), (236, 25, 252)]
    index_color     = 0
    current_bright  = 1
     
    delay_low       = 0
     
    pin17state      = True
    pin22state      = True
     
    if __name__ == '__main__':
        # Process arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
        args = parser.parse_args()
     
        # Create NeoPixel object with appropriate configuration.
        strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
        # Intialize the library (must be called once before other functions).
        strip.begin()
     
        print ('Press Ctrl-C to quit.')
        if not args.clear:
            print('Use "-c" argument to clear LEDs on exit')
     
        # attendre si on est moins d'une seconde de la minute suivante
        while datetime.now().second == 59: continue
        showArray(strip, get_color(), convert(*getHour()))
     
        try:
            while True:
     
     
                if datetime.now().second == 0:
     
                    output = convert(*getHour())
                    print(output)
                    showArray(strip, get_color(), convert(*getHour()))
     
                entreepin17 = GPIO.input(17)
                if (entreepin17 == True) and not pin17state:
                    pin17state = True
                    delay_low = 0
                    current_bright = round((current_bright+.1)%1.1,1) or .1
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin17 == False):
                    pin17state = False
                    print ('PIN17')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    colorWipe(strip, Color(0,0,0), 10)
                    current_bright = round((current_bright-.1),1)
                    while not GPIO.input(17): pass
                    time.sleep(temps / 1000) # anti rebond
                    while GPIO.input(17): time.sleep(temps / 1000)
                    showArray(strip, get_color(), convert(*getHour()))
     
     
     
                entreepin22 = GPIO.input(22)
                if (entreepin22 == True) and not pin22state:
                    pin22state = True
                    delay_low = 0
                    index_color = (index_color+1)%len(list_color)
                    # met à jour au cas de dépassement de minute
                    showArray(strip, get_color(), convert(*getHour()))
                if (entreepin22 == False):
                    pin22state = False
                    print ('PIN22')
                    delay_low += 1
                if delay_low == 20: # valeur à ajuster
                    index_color     = 0
                    showArray(strip, get_color(), convert(*getHour()))
                    while not GPIO.input(22): pass
                    pin22state = True
                    delay_low = 0
                    showArray(strip, get_color(), convert(*getHour()))
     
     
                entreepin24 = GPIO.input(24)
                if (entreepin24 == False):
                    print ('PIN24') 
                    # met à jour au cas de dépassement de minute
                    showArray(strip, Color(50,50,50), convert(*getHour()))
                time.sleep(temps / 1000)
     
        except KeyboardInterrupt:
                if args.clear:
                     colorWipe(strip, Color(0,0,0), 10)

  11. #71
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    ça marche :-)

  12. #72
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    pour les effets y a pas 36 solutions, soit la lib offre l'option de passer en argument les seules LEDs à utiliser, soit faut apporter les changements en C/C++, soit faut coder les fonctions soit-même en python, soit tu trouves autre chose à faire avec ce bouton ^^.

    tu pourrais faire une 'tite vidéo de ton montage en action ?

  13. #73
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par josmiley Voir le message
    pour les effets y a pas 36 solutions, soit la lib offre l'option de passer en argument les seules LEDs à utiliser
    https://github.com/jgarff/rpi_ws281x.../strandtest.py ça y est?

    Citation Envoyé par josmiley Voir le message
    soit tu trouves autre chose à faire avec ce bouton ^^.
    bah même si ce n'est pas "juste" les led utilisées mais la totalité ça serait dejà cool
    Citation Envoyé par josmiley Voir le message
    tu pourrais faire une 'tite vidéo de ton montage en action ?
    Je te fais ça de suite.... mais tu ne verra pas le vinyl... (je dois aller chercher le verre aujourd'hui et faire poser le vinyl plus tard




    Sinon... le lancement automatique au demarage du pi ça se passe comment?

  14. #74
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    lancer un programme au démarrage c'est expliqué là: https://raspberry-pi.fr/executer-pro...20votre%20PC).

  15. #75
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7

  16. #76
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    Citation Envoyé par 7ced7 Voir le message

    c'est un lien privé, faut indiquer 'tous les utilisateurs disposant du lien'.

  17. #77
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par josmiley Voir le message
    lancer un programme au démarrage c'est expliqué là: https://raspberry-pi.fr/executer-pro...20votre%20PC).
    voici mon fichier rc local :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
     
    # Print the IP address
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
      printf "My IP address is %s\n" "$_IP"
    fi
    /piLedClock/rpi_ws281x/python/wordclock.py
    exit 0
    ça ne fonctionne pas... qu'ai-je fais de mal?

  18. #78
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
     
    # Print the IP address
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
      printf "My IP address is %s\n" "$_IP"
    fi
    /usr/bin/python3 /piLedClock/rpi_ws281x/python/wordclock.py &
    exit 0
    mais tu es sûr du chemin absolu de ton fichier ? en générale ça commence par /home ...

  19. #79
    Futur Membre du Club
    Homme Profil pro
    diy
    Inscrit en
    Septembre 2020
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : diy
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Septembre 2020
    Messages : 61
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par josmiley Voir le message
    mais tu es sûr du chemin absolu de ton fichier ? en générale ça commence par /home ...
    comment trouver le chemin absolu? pour lancer le wordclock.py je fais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    cd piLedClock/rpi_ws281x/python
    et
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    sudo python3 wordclock.py

  20. #80
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 048
    Points : 1 378
    Points
    1 378
    Par défaut
    Citation Envoyé par 7ced7 Voir le message
    comment trouver le chemin absolu? pour lancer le wordclock.py je fais :
    cd piLedClock/rpi_ws281x/python
    et
    sudo python3 wordclock.py
    clic-droit sur le fichier -> propriété

Discussions similaires

  1. Python sur raspberry et POST
    Par joseph20480 dans le forum Général Python
    Réponses: 0
    Dernier message: 04/02/2018, 00h34
  2. Python Tweepy Raspberry
    Par pi3dany dans le forum Raspberry Pi
    Réponses: 4
    Dernier message: 14/03/2017, 18h54
  3. conseils pour serveur python sur raspberry
    Par nma dans le forum Raspberry Pi
    Réponses: 1
    Dernier message: 12/11/2016, 13h34
  4. Conenxion SSH python et raspberry
    Par Stoufiler dans le forum Réseau/Web
    Réponses: 4
    Dernier message: 14/06/2015, 17h24
  5. Python et Raspberry
    Par Horizon1956 dans le forum Raspberry Pi
    Réponses: 1
    Dernier message: 14/12/2014, 13h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo