Exemplo n.º 1
0
from nrf import Bridge

if len(sys.argv) == 2:
    if sys.argv[1] == '-c':
        camera_calibration = True
        print 'Entered camera calibration mode.'
    else:
        # -c: for turning on the calibration LED patterns
        print 'Usage:', sys.argv[0], '[-c]'
        sys.exit(1)
else:
    camera_calibration = False

nrf = Bridge()
cameras, ebugs, unknowns = nrf.assign_static_addresses('../libs/ebug_tab.json')

for addr, info in ebugs.items():
    print 'Initializing eBug: ', addr
    nrf.set_TX_address(addr)
    nrf.enable_LEDs(0, 1, 0, 0)
    nrf.LED_brightness(8)
    nrf.LCD_backlight(0)
    if camera_calibration == True:
        # Calibration LED pattern (upward looking set):
        # D2 is illuminated red - front (0 degrees) - GGRGG
        # D18 is illuminated blue - (180 degrees) - GGBGG
        red = 0x0800 + 0x4000 + 0x8000 + 0x0001 + 0x0040 + 0x0080 + 0x0100
        green = 0x1000 + 0x2000 + 0x0002 + 0x0020 + 0x0200 + 0x0400
        blue = 0x0010 + 0x0008 + 0x0004
        nrf.set_LEDs(red, green, blue)
Exemplo n.º 2
0
from __future__ import absolute_import
#import settings
import time
import sys
import threading
from multiprocessing import Process
from io import open

sys.path.insert(0, '../libs/')

from nrf import Bridge

nrf = Bridge()

while True:
    camera, eBugs, unknown = nrf.assign_static_addresses(path = \
                                                     u'../libs/ebug_tab.json')
    if camera:
        break
    else:
        print u" -------- Waiting for camera --------"
        time.sleep(0.03)

#set communication with the first camera detected
#to be changed when multiple cameras
nrf.set_TX_address(iter(camera).next())

#settings camera
# Do not play with the settings, we will fix them with camera.py
# So commenting them out.
# nrf.camera_write_reg(0x10, 20)
# values = [0x79, 0x9a, 0xb1, 0x5a, 0xc6, 0x70, 0xa3, 0x82]