Skip to content

Commit

Permalink
Merge branch 'main' into fix-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
PossiblyAShrub authored May 16, 2024
2 parents 339b30a + 2a3c235 commit 34d40cb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/modules/imaging/LED.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pymavlink.dialects.v20.all as dialect
from mavlink import MAVLinkDelegate


class StatusLeds:
"stores the state of LED lights"

def __init__(self, mavlink: MAVLinkDelegate, RGB=[0, 0, 0]):
self.RGB = RGB
self.mavlinkDelegate = mavlink

def change_color(self, RGB: list):
self.RGB = RGB
#print current color of LED
if (self.RGB[0] == 255 and self.RGB[1] == 0 and self.RGB[2] == 0):
print("RED COLOR")
elif (self.RGB[0] == 0 and self.RGB[1] == 255 and self.RGB[2] == 0):
print("GREEN COLOR")
elif (self.RGB[0] == 0 and self.RGB[1] == 0 and self.RGB[2] == 255):
print("BLUE COLOR")
else:
print(f"RGB values: {self.RGB}")
self.send_message()

def send_message(self):
message = dialect.MAVLink_debug_vect_message(name=bytes(
"LED_STATUS", 'utf-8'),
time_usec=0,
x=self.RGB[0],
y=self.RGB[1],
z=self.RGB[2])
self.mavlinkDelegate.send(message)

0 comments on commit 34d40cb

Please sign in to comment.