Example #1
0
#!/usr/bin/python

import curses
import random
import string
import smbus
from copy import copy
from time import sleep

from raspiomix import Raspiomix
import serial
import RPi.GPIO as GPIO

raspi = Raspiomix()
IS_PLUS = raspi.isPlus()

info = None

GPIOS = (
    Raspiomix.IO0,
    Raspiomix.IO1,
    Raspiomix.IO2,
    Raspiomix.IO3,
)

if IS_PLUS:
    GPIOS += (
        Raspiomix.IO4,
        Raspiomix.IO5,
        Raspiomix.IO6,
        Raspiomix.IO7,
Example #2
0
import sys
sys.path.append('Library/')
from raspiomix import Raspiomix
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)  # mode de fonctionnement GPIO
GPIO.setup(Raspiomix.IO0, GPIO.IN)  # configure port en sortie

r = Raspiomix()
ENTREE_CAN = 1

while True:
    print("La tension est de %f volt !" % r.readAdc(ENTREE_CAN))
    time.sleep(0)
Example #3
0
from raspiomix import Raspiomix
from bottle import route, run
from adxl345 import ADXL345
import time
import json
  
adxl345 = ADXL345()
r = Raspiomix()

@route('/accelero')

def accelero():
    axes = adxl345.getAxes(True)
    return json.dumps([{'x' : axes['x'], 'y' : axes['y'], 'z' : axes['z']}])

@route('/temp')

def temp():
    return json.dumps([{'temperature' : r.readAdc(0)*10 }])

run(host='0.0.0.0', port=8080, debug=True)
"""
while True:    
    axes = adxl345.getAxes(True)
    print "   x = %.3fG" % ( axes['x'] )
    print "   y = %.3fG" % ( axes['y'] )
    print "   z = %.3fG" % ( axes['z'] )
    print " "
    time.sleep(0.1)
"""
# -*- coding: utf-8 -*-
#!/usr/bin/python3
# mysqlWampPy3.py

import mysql.connector
from raspiomix import Raspiomix

cnx = mysql.connector.connect(host="192.168.56.1", user="******", password="", database="supervison")

# Création d'un curseur.
cur = cnx.cursor()

r = Raspiomix()
print("La tension est de %f Volt !" % r.readAdc(0))

# récuperer la tension grâce aux ports sur la
# raspiomix. -- 8 PORTS -- 

if r > --TENSION-- and r < --TENSION-- :
   print("La porte est fermée.")
   cursor.execute("""INSERT INTO etat_capteur(valeur) VALUES(?)""";(1))
# On insère 0 dans la table valeur de etat_capteur pour indiquer que
# la porte est fermée.

else if r > --TENSION-- and r < --TENSION-- :
   print("La porte est ouverte.")
   cursor.execute("""INSERT INTO etat_capteur(valeur) VALUES(?)""";(0))
# On insère 0 dans la table valeur de etat_capteur pour indiquer que
# la porte est ouverte.

else :
Example #5
0
Auteur : H. Dugast
Date : 10-01-2017
Matériel utilisé : carte raspberry, carte raspiOmix+, module grove Sliding potentiometer
Connexion : module potentiomètre -> AN1 raspiOmix+
Fonction :
    Convertit la tension analogique appliquée sur l'entrée AN1 en code
    puis à partir de ce dernier, affiche la tension calculée correspondant à l'entrée
"""

from raspiomix import Raspiomix
import RPi.GPIO as GPIO
import datetime
import time
from connect import *

r = Raspiomix()

class capteur_porte:
    
    etat_porte = r.readAdc(0)
    #etat_capteur = AN0
    entree_can = 3.3

    def __init__(self, etat_porte):
        
        self.etat_porte = etat_porte
    
    def __init__(self, etat_capteur):
    
        self.etat_capteur = etat_capteur
        
#!/usr/bin/python

import curses
import random
import string
import smbus
from copy import copy
from time import sleep

from raspiomix import Raspiomix
import serial
import RPi.GPIO as GPIO

raspi = Raspiomix()
IS_PLUS = raspi.isPlus()

info = None

GPIOS = (
    Raspiomix.IO0,
    Raspiomix.IO1,
    Raspiomix.IO2,
    Raspiomix.IO3,
)

if IS_PLUS:
    GPIOS += (
        Raspiomix.IO4,
        Raspiomix.IO5,
        Raspiomix.IO6,
        Raspiomix.IO7,
wait_after_cycle = cfg.getfloat('client', 'wait_after_cycle')

# Temps d'animation de leds
fade_in_time  = cfg.getfloat('leds', 'fade_in_time')
fade_out_time = cfg.getfloat('leds', 'fade_out_time')
wait_time     = cfg.getfloat('leds', 'wait_time')

# Variables de seuil pour la detection
seuil_detection_trappe = cfg.getfloat('sensor_calibration', 'seuil_detection_trappe')
seuil_detection_main   = cfg.getfloat('sensor_calibration', 'seuil_detection_main')
# seuil_detection_galet  = cfg.getfloat('sensor_calibration', 'seuil_detection_galet')

last_detection_value = seuil_detection_trappe

# Carte Raspiomix
r = Raspiomix()
GPIO.setmode(GPIO.BOARD)
# Pilotage servo
GPIO.setup(r.IO0, GPIO.OUT) # Mode board = 12, GPIO18
# Capteur presence galet, capteur sur entree analogique 0
ir_sensor = 0
# Pilotage Servo-moteur
motor = GPIO.PWM(r.IO0, 50)

#cfgimg.getint('images', 'next_img_index')

# Repertoire des images
img_dir = cfg.get('client', 'img_dir')
# Etape courante 
state = 'wait'
#
Example #8
0
from raspiomix import Raspiomix
import RPi.GPIO as GPIO
import pygame
import time

r = Raspiomix()
FPS = 4
GPIO.setmode(GPIO.BOARD)

GPIO.setup(r.IO0, GPIO.IN)

if GPIO.input(r.IO0) == 0:
    pygame.init()
    clock = pygame.time.Clock()
    movie = pygame.movie.Movie('museomix.mpg')
    screen = pygame.display.set_mode(movie.get_size())
    movie_screen = pygame.Surface(movie.get_size()).convert()

    movie.set_display(movie_screen)
    movie.play()
    playing = False

while True:
    if not (movie.get_busy()) and r.readAdc(3) > 0.0338:
        movie.rewind()
        movie.play()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            movie.rewind()
            playing = False
    screen.blit(movie_screen, (0, 0))
Example #9
0
from raspiomix import Raspiomix
import time

r = Raspiomix()

while True:
    print "%f Volt !" % r.readAdc(0)
    time.sleep(1)
Example #10
0
from raspiomix import Raspiomix
import time

r = Raspiomix()

while True:
    if r.readAdc(3) > 0.03378:
        print "%f Volt !" % r.readAdc(3)
Example #11
0
#!/usr/bin/python3.4
# coding: utf-8

from raspiomix import Raspiomix
import datetime
import time
from t1 import *

r = Raspiomix()
ENTREE_CAN = 0
print("1")


def insert(v1, v2):
    _v1 = v1
    _v2 = v2
    cur = connect.db.cursor()
    cur.execute(
        "INSERT INTO evenement(date_heure, id_etat_capteur, id_capteur, id_type_evenement)"
        "VALUES (NOW(), %s, 1 ,%s)", (_v1, _v2))
    cur.commit()
    cur.close()
    time.sleep(reponse)


print("2")


def tension(tension):
    _t = tension
    if tension < 2.4 and tension > 0.7: