As of October 2016, Raspbian does not yet include the latest Python release, Python 3.5. This means we will have to build it ourselves, and here is how to do it.
Install the required build-tools (some might already be installed on your system).
import sys | |
from spidev import SpiDev | |
class SPIFlash(object): | |
READ_ID = 0x9f | |
READ_RS = 0x05 | |
CHIP_ERASE = 0x60 | |
PAGE_READ = 0x3 |
from __future__ import print_function | |
from raspi_io import GPIO | |
__all__ = ['GPIOSPI'] | |
class GPIOSPI(object): | |
""" | |
SPI Frame | reg, reg | data 0 - 7| | |
""" | |
# Frame 10 bits |
#include <stdio.h> | |
#include <bcm2835.h> | |
int main(int argc, char **argv) | |
{ | |
if (!bcm2835_init()) { | |
fprintf(stderr, "bcm2835_init failed!\n"); | |
return -1; | |
} |
import time | |
import socket | |
import websocket | |
import concurrent.futures | |
def get_host_address(): | |
try: | |
for addr in socket.gethostbyname_ex(socket.gethostname())[2]: |