-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_thunder_leds_off.py
executable file
·64 lines (48 loc) · 1.67 KB
/
set_thunder_leds_off.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2024 by Murray Altheim. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2024-05-10
# modified: 2024-05-10
#
import sys, time, traceback
from datetime import datetime as dt
from colorama import init, Fore, Style
init()
from core.logger import Logger, Level
import hardware.ThunderBorg3
from hardware.ThunderBorg3 import ThunderBorg, ScanForThunderBorg, SetNewAddress
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
_tb1 = None
_tb2 = None
try:
_log = Logger('thun', Level.INFO)
_log.info("scanning for thunderborgs...")
ScanForThunderBorg()
_log.info("start...")
_tb1 = ThunderBorg(Level.INFO)
_tb1.i2cAddress = 0x16
_tb1.Init()
_tb2 = ThunderBorg(Level.INFO)
_tb2.i2cAddress = 0x15
_tb2.Init()
# thunderborg 1 ...............................
if _tb1:
_tb1.SetLedShowBattery(False)
_tb1.SetLeds(0.0, 0.0, 0.0) # black
# thunderborg 2 ...............................
if _tb2:
_tb2.SetLedShowBattery(False)
_tb2.SetLeds(0.0, 0.0, 0.0) # black
_log.info("done.")
except KeyboardInterrupt:
_log.info('Ctrl-C caught; exiting...')
except Exception as e:
_log.error('{} thrown in thunderborg test: {}\n{}'.format(type(e), e, traceback.format_exc()))
finally:
pass
#EOF