mirror of
https://github.com/RGBCube/GDUS
synced 2025-07-28 21:47:45 +00:00
Add local code
This commit is contained in:
parent
d525fd353f
commit
fcbfd988d5
1 changed files with 19 additions and 0 deletions
19
rpid/rpid/main.py
Normal file
19
rpid/rpid/main.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from fastapi import FastAPI
|
||||
from RPi import GPIO as gpio
|
||||
|
||||
LED_PIN = 17
|
||||
|
||||
gipo.setmode(gpio.BCM)
|
||||
|
||||
state = False
|
||||
|
||||
def set(state: bool) -> None:
|
||||
gpio.output(LED, int(!state))
|
||||
|
||||
set(state)
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/toggle")
|
||||
async def toggle() -> None:
|
||||
set(!state)
|
Loading…
Add table
Add a link
Reference in a new issue