﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://bacasable.arpitania.eu//index.php?action=history&amp;feed=atom&amp;title=Code_Source_Python_Ticket4Bath</id>
	<title>Code Source Python Ticket4Bath - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://bacasable.arpitania.eu//index.php?action=history&amp;feed=atom&amp;title=Code_Source_Python_Ticket4Bath"/>
	<link rel="alternate" type="text/html" href="https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;action=history"/>
	<updated>2026-04-06T18:17:26Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=7388&amp;oldid=prev</id>
		<title>Eric le 27 avril 2016 à 10:21</title>
		<link rel="alternate" type="text/html" href="https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=7388&amp;oldid=prev"/>
		<updated>2016-04-27T10:21:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Version du 27 avril 2016 à 10:21&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Ligne 1 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 1 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Version plus complète du code : [[Code Source Ticket4Bath]].&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import time&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import time&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eric</name></author>
		
	</entry>
	<entry>
		<id>https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=7386&amp;oldid=prev</id>
		<title>Eric : Eric a déplacé la page Code Source Python vers Code Source Python Ticket4Bath sans laisser de redirection</title>
		<link rel="alternate" type="text/html" href="https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=7386&amp;oldid=prev"/>
		<updated>2016-04-27T10:19:26Z</updated>

		<summary type="html">&lt;p&gt;Eric a déplacé la page &lt;a href=&quot;/index.php?title=Code_Source_Python&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Code Source Python (page inexistante)&quot;&gt;Code Source Python&lt;/a&gt; vers &lt;a href=&quot;/index.php?title=Code_Source_Python_Ticket4Bath&quot; title=&quot;Code Source Python Ticket4Bath&quot;&gt;Code Source Python Ticket4Bath&lt;/a&gt; sans laisser de redirection&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Version du 27 avril 2016 à 10:19&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;fr&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Aucune différence)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Eric</name></author>
		
	</entry>
	<entry>
		<id>https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=795&amp;oldid=prev</id>
		<title>Marion Rchr : Page créée avec « &lt;pre&gt; import time import grovepi import sys import RPi.GPIO as GPIO import smbus   # Connect the Grove PIR Motion Sensor to digital port D8 # SIG,NC,VCC,GND led_sensor = 3... »</title>
		<link rel="alternate" type="text/html" href="https://bacasable.arpitania.eu//index.php?title=Code_Source_Python_Ticket4Bath&amp;diff=795&amp;oldid=prev"/>
		<updated>2015-04-25T10:01:57Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « &amp;lt;pre&amp;gt; import time import grovepi import sys import RPi.GPIO as GPIO import smbus   # Connect the Grove PIR Motion Sensor to digital port D8 # SIG,NC,VCC,GND led_sensor = 3... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
import time&lt;br /&gt;
import grovepi&lt;br /&gt;
import sys&lt;br /&gt;
import RPi.GPIO as GPIO&lt;br /&gt;
import smbus&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Connect the Grove PIR Motion Sensor to digital port D8&lt;br /&gt;
# SIG,NC,VCC,GND&lt;br /&gt;
led_sensor = 3&lt;br /&gt;
touch_sensor = 4&lt;br /&gt;
buz_sensor = 2&lt;br /&gt;
&lt;br /&gt;
compt = 1&lt;br /&gt;
&lt;br /&gt;
#Tableau des notes de musique&lt;br /&gt;
notes = ['E7', 'E7', 'E7', 'C7', 'E7', 'G7', 'G6', 'C7', 'G6', 'E6', 'A6', 'B6', 'AS6', 'A6',&lt;br /&gt;
	'G6', 'E7', 'G7', 'A7', 'F7', 'G7', 'E7', 'C7', 'D7', 'B6', 'C7', 'G6', 'E6', 'A6', 'B6', 'AS6', 'A6',&lt;br /&gt;
	'G6', 'E7', 'G7', 'A7', 'F7', 'G7', 'E7', 'C7', 'D7', 'B6', ' ' ]&lt;br /&gt;
	&lt;br /&gt;
#Longueur des notes&lt;br /&gt;
beats = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,&lt;br /&gt;
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, .75, .75, .75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,&lt;br /&gt;
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, .75, .75, .75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]&lt;br /&gt;
tempo = 100&lt;br /&gt;
&lt;br /&gt;
grovepi.pinMode(buz_sensor,&amp;quot;OUTPUT&amp;quot;)&lt;br /&gt;
grovepi.pinMode(led_sensor,&amp;quot;OUTPUT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Adresses I2C du LCD&lt;br /&gt;
DISPLAY_RGB_ADDR = 0x62&lt;br /&gt;
DISPLAY_TEXT_ADDR = 0x3e&lt;br /&gt;
&lt;br /&gt;
# Bus de liaison de la Raspberry pi si pi1 = 0 et pi2 = 1&lt;br /&gt;
rev = GPIO.RPI_REVISION&lt;br /&gt;
bus = smbus.SMBus(1)&lt;br /&gt;
&lt;br /&gt;
#Fonction permettant de parametrer la couleur de fond du LCD&lt;br /&gt;
def setRGB(r,g,b):&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,0,0)&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,1,0)&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,0x08,0xaa)&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,4,r)&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,3,g)&lt;br /&gt;
    bus.write_byte_data(DISPLAY_RGB_ADDR,2,b)&lt;br /&gt;
&lt;br /&gt;
#Commande pour afficher    &lt;br /&gt;
def textCommand(cmd):&lt;br /&gt;
    bus.write_byte_data(DISPLAY_TEXT_ADDR,0x80,cmd)&lt;br /&gt;
&lt;br /&gt;
#Fonction pour afficher le texte avec retour a la ligne    &lt;br /&gt;
def setText(text):&lt;br /&gt;
    textCommand(0x01) # clear display&lt;br /&gt;
    time.sleep(.05)&lt;br /&gt;
    textCommand(0x08 | 0x04) # display on, no cursor&lt;br /&gt;
    textCommand(0x28) # 2 lines&lt;br /&gt;
    time.sleep(.05)&lt;br /&gt;
    count = 0&lt;br /&gt;
    row = 0&lt;br /&gt;
    for c in text:&lt;br /&gt;
        if c == '\n' or count == 16:&lt;br /&gt;
            count = 0&lt;br /&gt;
            row += 1&lt;br /&gt;
            if row == 2:&lt;br /&gt;
                break&lt;br /&gt;
            textCommand(0xc0)&lt;br /&gt;
            if c == '\n':&lt;br /&gt;
                continue&lt;br /&gt;
        count += 1&lt;br /&gt;
        bus.write_byte_data(DISPLAY_TEXT_ADDR,0x40,ord(c))&lt;br /&gt;
		&lt;br /&gt;
#Blink deux fois rouge/blanc&lt;br /&gt;
def blink2():&lt;br /&gt;
	setRGB(255,0,0)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,255,255)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,0,0)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,255,255)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,0,0)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
&lt;br /&gt;
#Blink une fois rouge/blanc&lt;br /&gt;
def blink1():&lt;br /&gt;
	setRGB(255,0,0)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,255,255)&lt;br /&gt;
	time.sleep(.05)&lt;br /&gt;
	setRGB(255,0,0)&lt;br /&gt;
	&lt;br /&gt;
#Fonction qui joue la note (tone) durant une certaine duree&lt;br /&gt;
def playTone(tone, duration):&lt;br /&gt;
	for i in range(0,duration * 1000L, tone * 2 ):&lt;br /&gt;
		grovepi.digitalWrite(buz_sensor, 1)&lt;br /&gt;
		time.sleep(tone * .000001)&lt;br /&gt;
		grovepi.digitalWrite(buz_sensor, 0)&lt;br /&gt;
		time.sleep(tone * .000001)&lt;br /&gt;
 &lt;br /&gt;
#Fonction qui verifie que la note demandee existe, s'apppuie sur playTone&lt;br /&gt;
def playNote(note, duration):&lt;br /&gt;
	names = [ 'a', 'E6', 'E7', 'C7', 'G7', 'G6', 'A6', 'B6', 'AS6', 'A7', 'F7', 'D7' ]&lt;br /&gt;
	tones = [ 10, 1319, 2637, 2093, 3136, 1568, 1760, 1976, 1865, 3520, 2794, 2349 ]&lt;br /&gt;
	&lt;br /&gt;
	for i in range(0,8):&lt;br /&gt;
		if (names[i] == note):&lt;br /&gt;
			playTone(tones[i], duration)&lt;br /&gt;
			&lt;br /&gt;
#Fonction pour lancer la musique, s'appuie sur playNote et playTone&lt;br /&gt;
def music_moussaillon():&lt;br /&gt;
	for i in range(0,78):&lt;br /&gt;
		if(notes[i] == ' '):&lt;br /&gt;
			time.sleep(beats[i] * tempo)&lt;br /&gt;
		else:&lt;br /&gt;
			playNote(notes[i], beats[i] * tempo)&lt;br /&gt;
		time.sleep(0.15)&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Routine de fonctionnement&lt;br /&gt;
grovepi.digitalWrite(led_sensor,0)	&lt;br /&gt;
grovepi.digitalWrite(buz_sensor,0)&lt;br /&gt;
&lt;br /&gt;
setText('Etat de la SdB : Libre')	&lt;br /&gt;
setRGB(0,255,0)&lt;br /&gt;
&lt;br /&gt;
while True:	&lt;br /&gt;
	if (grovepi.digitalRead(touch_sensor) == 1):&lt;br /&gt;
		if(compt%2 == 1):&lt;br /&gt;
			compt += 1&lt;br /&gt;
			grovepi.digitalWrite(led_sensor,1)&lt;br /&gt;
			setText('Etat de la SdB : Occupe (15 min)')&lt;br /&gt;
			setRGB(255,0,0)  #rouge&lt;br /&gt;
			time.sleep(5)&lt;br /&gt;
			blink1()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (30 sec)')&lt;br /&gt;
			time.sleep(10)&lt;br /&gt;
			blink1()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (10 sec)')&lt;br /&gt;
			time.sleep(5)&lt;br /&gt;
			blink1()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (5 sec)')&lt;br /&gt;
			time.sleep(1)&lt;br /&gt;
			blink2()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (4 sec)')&lt;br /&gt;
			time.sleep(1)&lt;br /&gt;
			blink2()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (3 sec)')&lt;br /&gt;
			time.sleep(1)&lt;br /&gt;
			blink2()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (2 sec)')&lt;br /&gt;
			time.sleep(1)&lt;br /&gt;
			blink2()&lt;br /&gt;
			setText('Etat de la SdB : Occupe (1 sec)')&lt;br /&gt;
			time.sleep(1)&lt;br /&gt;
			blink2()&lt;br /&gt;
			&lt;br /&gt;
			setText('Utilisation \n      finie')&lt;br /&gt;
			blink2()&lt;br /&gt;
			blink2()&lt;br /&gt;
		&lt;br /&gt;
		else:&lt;br /&gt;
			compt += 1&lt;br /&gt;
			grovepi.digitalWrite(led_sensor,0)&lt;br /&gt;
			setText('Etat de la SdB : Libre')	&lt;br /&gt;
			setRGB(0,255,0)		&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Marion Rchr</name></author>
		
	</entry>
</feed>