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
import socket | |
def get_ip(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
try: | |
# doesn't even have to be reachable | |
s.connect(('1.2.3.4', 1)) | |
my_ip_addr = s.getsockname()[0] | |
except: | |
my_ip_addr = '127.0.0.1' |
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
import time | |
import sys | |
import signal | |
from PyMata.pymata import PyMata | |
SERVO_MOTOR = 5 # servo attached to this pin | |
# create a PyMata instance |
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
#!/usr/bin/env python3 | |
import asyncio | |
import serial | |
class ArduinoSerial(): | |
def __init__(self): | |
""" | |
Open the serial port at 57600 |
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
/* I used this web page as a basis: http://www.chovy.com/web-development/self-signed-certs-with-secure-websockets-in-node-js/ | |
1. I created the key and cert using the instructions. | |
2. I created a modified secure websocket server - included below | |
3. I created a simplified Scratch extension - included below. | |
4. I added the cert to firefox using the instructions in the article for Chrome. This worked | |
5. I tried to add the cert to chrome by accessing https://0.0.0.0:1234, but this brought me to a search page. | |
6. I then created a pkc12 cert and used the settings to add it to chrome, but could not get a wss connection. | |
Bottom line - I got Firefox to work, but not chrome |
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
import time | |
import sys | |
from PyMata.pymata import PyMata | |
# digital pin 13 is connected to an LED | |
BOARD_LED = 13 | |
# create a PyMata instance | |
firmata = PyMata("/dev/ttyATH0") |