This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python main.py --endpoint AWS_IOT_ENDPOINT --rootCA root-ca-cert.pem --cert <device>.cert.pem --key <device>.private.key --thingName <device_name> --topic 'ble/discovered_device' --mode publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo -E ./gg-device-setup-latest.sh bootstrap-greengrass-interactive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget -q -O ./gg-device-setup-latest.sh https://d1onfpft10uf5o.cloudfront.net/greengrass-device-setup/downloads/gg-device-setup-latest.sh && chmod +x ./gg-device-setup-latest.sh && sudo -E ./gg-device-setup-latest.sh bootstrap-greengrass-interactive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export AWS_ACCESS_KEY_ID=<user-access-key-here> | |
$ export AWS_SECRET_ACCESS_KEY=<user-secret-key-here> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enable_notify(peripheral, service_uuid, char_uuid): | |
setup_data = b"\x01\x00" | |
svc = peripheral.getServiceByUUID(service_uuid) | |
print(svc) | |
ch = peripheral.getCharacteristics(uuid=char_uuid)[0] | |
print(ch) | |
print('Characteristic handle: %d' % ch.valHandle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# attempt connecting | |
try: | |
print('Connecting to ' + device_addr) | |
_ble_peripheral = btle.Peripheral(device_addr, addrType=btle.ADDR_TYPE_RANDOM) | |
_ble_peripheral.withDelegate(_ble_delegate) | |
# Setup to turn notifications on, e.g. | |
enable_notify(_ble_peripheral, IMU_SERVICE_UUID, IMU_SAMPLE_CHAR_UUID) | |
except Exception as e: | |
print(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bluepy import btle | |
from bluepy.btle import Scanner, DefaultDelegate | |
from ble_delegate import ble_delegate | |
# delegate instance | |
params = [None] | |
_ble_delegate = ble_delegate(params) # params is whatever you need | |
# assign the delegate to the scanner | |
scanner = Scanner().withDelegate(_ble_delegate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bluepy import btle | |
from bluepy.btle import Scanner, DefaultDelegate | |
class ble_delegate(DefaultDelegate): | |
def __init__(self, params): | |
btle.DefaultDelegate.__init__(self) | |
# ... initialise here | |
def handleDiscovery(self, dev, isNewDev, isNewData): | |
if isNewDev: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define T_SAFE 10 // minimum low/high in one duty cycle to avoid zero value | |
#define T_MIN 500 // min value for HIGH period | |
#define T_MAX 2500 // max value for HIGH period | |
#define T T_MAX+T_SAFE // duty cycle for servo motor in micro-seconds | |
int servo_pin = 9; // PWM pin | |
void setup() { | |
pinMode(servo_pin, OUTPUT); // sets the pin as output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ File.list('/') |
NewerOlder