Skip to content

Instantly share code, notes, and snippets.

View whatnick's full-sized avatar

Tisham Dhar whatnick

View GitHub Profile
@whatnick
whatnick / ATM90E36_Basic_ESP32.ino
Created March 29, 2020 00:01
ESP32 ATm90E36 Basic code
/* ATM90E36 Energy Monitor Demo Application
The MIT License (MIT)
Copyright (c) 2016 whatnick and Ryzee
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-5.3.2, py-1.8.0, pluggy-0.13.1
rootdir: /home/ubuntu/eo-datasets, inifile: setup.cfg, testpaths: eodatasets3, tests
plugins: flake8-1.0.4, cov-2.8.1, hypothesis-4.54.0
collected 94 items
eodatasets3/documents.py .... [ 4%]
eodatasets3/images.py ... [ 7%]
eodatasets3/properties.py .. [ 9%]
eodatasets3/ui.py . [ 10%]
@whatnick
whatnick / gist:51858ca74d4a6338a03b9eaba12422ef
Last active December 3, 2019 11:08
OpenOCD output for sending bitstream to ECP5 part
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 25000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Warn : Transport "jtag" was already selected
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
@whatnick
whatnick / pydrive-dance.py
Created June 13, 2019 12:53
Integration between PyDrive and Flask-Dance
oauth_token = session['google_oauth_token']
from oauth2client.client import OAuth2Credentials
from datetime import datetime
expirty_str = str(datetime.fromtimestamp(oauth_token['expires_at']))
with flask_app.app_context():
token_data = {
'access_token' : oauth_token['access_token'],
'token_expiry' : expirty_str,
'user_agent' : 'PyDrive Automation',
'refresh_token' : None,
@whatnick
whatnick / pydrive-dance.py
Created June 13, 2019 12:53
Integration between PyDrive and Flask-Dance
oauth_token = session['google_oauth_token']
from oauth2client.client import OAuth2Credentials
from datetime import datetime
expirty_str = str(datetime.fromtimestamp(oauth_token['expires_at']))
with flask_app.app_context():
token_data = {
'access_token' : oauth_token['access_token'],
'token_expiry' : expirty_str,
'user_agent' : 'PyDrive Automation',
'refresh_token' : None,
import machine
import time
SysStatus = 0x01 #System Status
sck = machine.Pin(5,machine.Pin.OUT)
mosi = machine.Pin(18,machine.Pin.OUT)
miso = machine.Pin(19,machine.Pin.IN)
cs1 = machine.Pin(15,machine.Pin.OUT)
cs2 = machine.Pin(33,machine.Pin.OUT)
@whatnick
whatnick / DS1682_DeepSleep.ino
Created May 8, 2017 15:35
DS1682+ESP8266 based pulse counter with deepsleep
#include <Wire.h>
/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define DS1682_ADDR 0x6B
#define EVENT_COUNTER 0x09
@whatnick
whatnick / RealPowerMeter_NoWifi
Last active December 29, 2022 12:52
Real Power Measurement over Serial port for classice through-hole ADS1115 + NodeMCU Energy Monitor
/*
* This sketch sends ads1115 current sensor data via out over serial port.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
* - https://github.com/adafruit/Adafruit_SSD1306
* - https://github.com/adafruit/Adafruit-GFX-Library
*
* The above libraries can be directly installed via the Arduino IDE
*
import time
from tentacle_pi.LM75 import LM75
import httplib, urllib
from time import localtime, strftime
lm = LM75(0x48,"/dev/i2c-1")
while(True):
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
@whatnick
whatnick / test_LM75.py
Created July 10, 2016 14:22
Test LM75 temperature sensor
import time
from tentacle_pi.LM75 import LM75
lm = LM75(0x48,"/dev/i2c-1")
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
time.sleep(2)