Skip to content

Instantly share code, notes, and snippets.

View bembu's full-sized avatar

Peter Kronström bembu

View GitHub Profile
/*
Yksinkertainen scripti Wemos D1 Minille.
Koodi lähettää napinpainalluksella HTTP-pyynnön
haluttuun osoitteeseen .
Lyhyt painallus lähettää pyynnön osoitteeseen
server_ip:port/photo
Asenna Arduino core ESP8266-alustalle osoitteesta
https://github.com/esp8266/Arduino
@bembu
bembu / intervalometer.cpp
Last active October 16, 2016 19:49
A simple intervalometer for Arduino. Requires a rotary encoder, a SSD1306 OLED display and a bunch of analog electronics. With display idle sleep.
#include <Arduino.h>
#include <SPI.h> // problems with PlatformIO
#include <U8g2lib.h>
#include <Wire.h>
#include <ClickEncoder.h>
#include <TimerOne.h>
#include <TaskScheduler.h>
/*
Yksinkertainen scripti Wemos D1 Minille.
Koodi lähettää napinpainalluksella HTTP-pyynnön
haluttuun osoitteeseen .
Pitkä painallus lähettää pyynnön osoitteeseen
server_ip:port/video
Lyhyt painallus osoitteeseen
server_ip:port/photo
@bembu
bembu / selfie_cam_advanced.py
Last active October 18, 2016 06:56
An advanced selfie cam script, that can also take short videos and send them to telegram (which autoplays them!)
"""
Edistyneempi palvelinskripti.
localhost:5000/photo ottaa kuvan,
localhost:5000/video ottaa lyhyen videon.
Taman jalkeen paketti lahetetaan ennalta-
maaritetylle Telegram-kanavalle.
Muokkaa muuttujat
BOT_API_TOKEN ja GROUP_ID
ennen ajamista.
@bembu
bembu / get_group_id.py
Last active October 17, 2016 15:18
A short script to get Telegram group_id
"""
Skripti noutaa botin päivitykset ja parsii vastauksesta
group_id:t.
>> python get_group_id.py
@author Peter Kronstrom
"""
import json
@bembu
bembu / telegram_irc_bridge.py
Last active September 20, 2020 20:29
A script that acts as a bridge between IRC and Telegram.
"""
A script that acts as a messaging bridge between Telegram and IRC.
Works in Python 3.x
Installation:
1. pip install pydle
2. go create a Telegram bot by talking to BotFather (https://telegram.me/botfather)
3. create a telegram group, and send a curl to:
curl -s -X POST "https://api.telegram.org/bot<BOT_TOKEN>w/getUpdates"
4. get the group_id from the response
@bembu
bembu / selfie_cam.py
Last active October 17, 2016 15:20
MB #3 -palvelinskripti
"""
Palvelinskripti.
Laheta pyynto osoitteeseen localhost:5000/photo
(esim. avaamalla selaimen). Kamera ottaa kuvan
ja lahettaa sen Telegram-kanavalle.
Koodista on vaihdettava <api-token> ja <group-id>,
jotta se toimii.
>> python selfie_cam.py
@bembu
bembu / wemos_oled_clock_ntp_synced.ino
Created May 26, 2016 10:59
A Wemos digital clock showing NTP Timeserver synced time on an OLED shield
#include <TimeLib.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
// Using a modified fork from
// https://github.com/mcauser/Adafruit_SSD1306/tree/esp8266-64x48
@bembu
bembu / esp8266_dht_node.ino
Created March 12, 2016 08:57
Wemos D1 Mini /w DHT22 POSTin temperature to the server
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoOTA.h>
#include <Ticker.h>
#include "DHT.h"
#define DHTPIN D4
#define BUTTONPIN D3
#define DHTTYPE DHT22
#define MEASUREMENT_INTERVAL 5000
@bembu
bembu / wemos_mhz14.ino
Created March 11, 2016 15:33
Wemos D1 Mini + MH-Z14 + SoftwareSerial
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <SoftwareSerial.h>
#include <Ticker.h>
const char* ssid = "Bembun";
const char* password = "ananasakaama";