Commit c8dc24e6 authored by Klint Youngmeyer's avatar Klint Youngmeyer
Browse files

Add get_led function

parent 508d8c39
......@@ -44,3 +44,17 @@ def get_switch(var_list):
return response_data.encode('utf-8')
def get_led(var_list):
if var_list:
led_num = var_list[0]
led_num = 1
led = pyb.LED(led_num)
if led.intensity() == 255: # CutiPy reports 255 as off. LED pins sink current, instead of source.
response_data = ujson.dumps({'status': 'off'})
response_data = ujson.dumps({'status': 'on'})
return response_data.encode('utf-8')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment