Skip to content

Instantly share code, notes, and snippets.

View benjaminchodroff's full-sized avatar

Benjamin Evans Chodroff benjaminchodroff

View GitHub Profile
@benjaminchodroff
benjaminchodroff / node1.py
Created February 18, 2017 05:57
LoPy LoRa range test - transmitter
import socket
import time
import struct
from network import LoRa
import pycom
pycom.heartbeat(False)
pycom.rgbled(0x000fff) #blue
# A basic package header, B: 1 byte for the deviceId, B: 1 bytes for the pkg size
_LORA_PKG_FORMAT = "BB%ds"
_LORA_PKG_ACK_FORMAT = "BBB"
@benjaminchodroff
benjaminchodroff / main.py
Created February 18, 2017 05:55
LoPy LoRa range test - listener
# Benjamin Chodroff, 2017
# This is the main listening gateway
# It's job is to receive LoRa messages and, if a color, set the LED to that color
# Otherwise, it will set unknown messages or errors as "white"
import machine
button=machine.Pin("G17",machine.Pin.IN, pull=machine.Pin.PULL_UP)
led=machine.Pin("G16", machine.Pin.OUT)
led.value(1)
#If the dev button is not pressed (0) then run this device in broadcast mode
if button():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Verifying that +benjaminchodroff is my blockchain ID. https://onename.com/benjaminchodroff