Skip to content

Instantly share code, notes, and snippets.

@huggre
huggre / p2p_energy_trade_p2.py
Created August 14, 2020 14:38
Python code for the "Integrating physical devices with IOTA - Peer-to-peer energy trading with IOTA Part 2" tutorial
#!/usr/bin/env python
# Import PyOTA library
import iota
from iota import Address
# Import time
import time
# Import the INA3221 library
@huggre
huggre / lambda_function.py
Created August 28, 2020 10:00
Lambda function for the Amazon Alexa Tutorial
"""
This is a Python template for Alexa to get you building skills (conversations) quickly.
"""
from __future__ import print_function
from iota import Iota
api = Iota('https://nodes.devnet.iota.org:443')
@huggre
huggre / contracts...MyContract.sol
Created October 13, 2022 19:15
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// this line is added to create a gist. Empty file is not allowed.
/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a GPIO pin depending on the request
* http://server_ip/gpio/0 will set the GPIO2 low,
* http://server_ip/gpio/1 will set the GPIO2 high
* server_ip is the IP address of the ESP8266 Arduino module, will be
* printed to Serial when the module is connected.
*/
// Include the ESP8266 library
@huggre
huggre / let_there_be_light.py
Last active January 28, 2024 13:47
Integrating physical devices with IOTA and Python
# Imports some Python Date/Time functions
import time
import datetime
# Imports GPIO library
import RPi.GPIO as GPIO
# Imports the PyOTA library
from iota import Iota
from iota import Address
# Import the httplib2 library and create a http object.
import httplib2
http = httplib2.Http()
# Define URL's used when sending http requests
url_on = 'http://192.168.100.9/gpio/1'
url_off = 'http://192.168.100.9/gpio/0'
# Imports some Python Date/Time functions
import time
# Import the requests library to send http request to coinbase.com
import requests
# Import json library for reading json data returned by the http request
import json
# Import the configparser library used for reading and writing to let_there_be_light.ini
import configparser
# Import some funtions from TkInter
# Import datetime library
from datetime import datetime
# Import GPIO library
import RPi.GPIO as GPIO
# Import simplified version of the MFRC522 library
import SimpleMFRC522
# Import the PyOTA library
# Imports from the PyOTA library
from iota import Iota
from iota import Address
from iota import Transaction
from iota import TryteString
# Import json library
import json
# Import datetime libary
from iota import Iota
import random
import RPi.GPIO as GPIO
import MFRC522
import signal
from textwrap import wrap
# Set seed to <blank>
seed=""