This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
LedPin = 12 # pin12 --- led | |
BtnPin = 18 # pin12 --- button | |
GPIO.setmode(GPIO.BOARD) # Pinagem física | |
GPIO.setup(LedPin, GPIO.OUT) # Pino de led como saída | |
GPIO.setup(BtnPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Pino do botão como saída e aciona o pull-up | |
GPIO.output(LedPin, GPIO.HIGH) # Desliga o led |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
LedPin1 = 12 # pin12 --- led | |
LedPin2 = 16 # pin16 --- led | |
BtnPin1 = 18 # pin18 --- button | |
BtnPin2 = 22 # pin22 --- button | |
GPIO.setmode(GPIO.BOARD) # Pinagem física | |
GPIO.setup([LedPin1, LedPin2], GPIO.OUT) # Pino de led como saída | |
GPIO.setup(BtnPin1, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Pino do botão como saída e aciona o pull-up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
LedPin1 = 12 # pin12 --- led | |
LedPin2 = 16 # pin16 --- led | |
BtnPin1 = 18 # pin18 --- button | |
BtnPin2 = 22 # pin22 --- button | |
GPIO.setmode(GPIO.BOARD) # Pinagem física | |
GPIO.setup([LedPin1, LedPin2], GPIO.OUT) # Pino de led como saída |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is generated from information provided by the datasource. Changes | |
# to it will not persist across an instance reboot. To disable cloud-init's | |
# network configuration capabilities, write a file | |
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: | |
# network: {config: disabled} | |
network: | |
ethernets: | |
eth0: | |
dhcp4: true | |
optional: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The top level settings are used as module | |
# and system configuration. | |
# A set of users which may be applied and/or used by various modules | |
# when a 'default' entry is found it will reference the 'default_user' | |
# from the distro configuration specified below | |
users: | |
- default | |
# If this is set, 'root' will not be able to ssh in and they |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
class TempSensor: | |
'''Classe para realizar a leitura de temperatura de um sensor DS18B20. | |
:args: | |
_id: ID único do sensor | |
''' | |
def __init__(self, _id): | |
self._id = _id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import threading | |
import os | |
import pathlib | |
from datetime import datetime | |
from .sensor import TempSensor | |
class TempSensorManager(threading.Thread): | |
'''Classe para gerenciar os sensores disponíveis no sistema.''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __read_temp_file(): | |
'''Carrega todas linhas do arquivo criado pelo sensor.''' | |
devices_dir = pathlib.Path('/sys/bus/w1/devices') | |
sensor_file = devices_dir / self._id / 'w1_slave' | |
# Le todas as linhas | |
f = open(sensor_file, 'r') | |
lines = f.readlines() | |
f.close() | |
return lines | |
def read_temp(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from eve import Eve | |
from .sensor_manager import TempSensorManager | |
# API configuration | |
SETTINGS = { | |
'DOMAIN': { | |
'sensors': { | |
'schema': { | |
'_id': {'type': 'string', 'unique': True}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { override, fixBabelImports, addLessLoader, addWebpackPlugin } = require('customize-cra'); | |
const { getThemeVariables } = require('antd/dist/theme'); | |
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin'); | |
module.exports = override( | |
fixBabelImports('import', { | |
libraryName: 'antd', | |
libraryDirectory: 'es', | |
style: true, |
OlderNewer