GithubHelp home page GithubHelp logo

brucestull / raspi-remote-lamp Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 98 KB

Flask app to control GPIO pin 17 from remote web browser.

License: Creative Commons Zero v1.0 Universal

Python 100.00%

raspi-remote-lamp's Introduction

Remote Controlled Lamp with Raspberry Pi Zero W and Raspberry Pi Pico

Flask app to control a lamp with a Raspberry Pi Zero W and a Raspberry Pi Pico.

Branches

  • Raspberry Pi Zero connects to local WiFi
  • Raspberry Pi Pico connects to local WiFi
  • Functional endpoints
    • /gpio/
    • /gpio/lamp-status/
    • /gpio/on
    • /gpio/off

Links

Links and URLS

Setup

Raspberry Pi - Running Raspberry Pi OS

  1. sudo apt-get update && sudo apt-get upgrade -y
  2. sudo apt-get install git
  3. sudo apt-get install pipenv
  4. ssh-keygen -t ed25519 -C "[email protected]"
  5. eval "$(ssh-agent -s)"
  6. ssh-add ~/.ssh/id_ed25519
  7. cat ~/.ssh/id_ed25519*
  8. https://github.com/settings/keys
  9. ssh -T [email protected]
  10. git config --global user.email "[email protected]"
  11. git config --global user.name "Name"
  12. git clone <REPOSITORY_URL>
  13. cd <REPOSITORY_DIRECTORY>
  14. pipenv install

raspi-remote-lamp's People

Contributors

brucestull avatar

Watchers

 avatar

raspi-remote-lamp's Issues

Add tests to `raspi_zero\hardware_tests\test_hardware_control.py`

Inspiration

flynntknapp@LAMP-SERVER:~/Programming/raspi-zero-lamp-server/raspi_zero $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi.GPIO as GPIO
>>> from hardware_control import HardwareControl
>>> hc = HardwareControl(18)
>>> hc.get_lamp_pin_status()
'OFF'
>>> hc.turn_lamp_on()
'Lamp turned on.'
>>> hc.get_lamp_pin_status()
'ON'
>>> hc.turn_lamp_off()
'Lamp turned off.'
>>> hc.get_lamp_pin_status()
'OFF'
>>> GPIO.output(18, GPIO.HIGH)
>>> hc.get_lamp_pin_status()
'ON'
>>> GPIO.output(18, GPIO.LOW)
>>> hc.get_lamp_pin_status()
'OFF'
>>>

Switch status change causes lamp toggle.

Update code so that change in switch state causes toggle of lamp status. This will help with user experience since they could use web app or switch to toggle the lamp.

Current code has lamp on when switch is on.

Refactor `led_fast_blink` to `led_blink`.

Current

def led_fast_blink(led, cycles):
    for _ in range(cycles):
        led.on()
        sleep(0.1)
        led.off()
        sleep(0.1)

New

def led_blink(led, time_diff=0.1, cycles=2):
    for _ in range(cycles):
        led.on()
        sleep(time_diff)
        led.off()
        sleep(time_diff)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.