Skip to content

Instantly share code, notes, and snippets.

require 'pp'
require 'date'
require 'tempfile'
require 'open3'
=begin
## data file path
#{DATADIR}/YYYY/MM/DD.txt
#include <ESP8266WiFi.h>
const char* ssid = "ssid";
const char* password = "password";
const char* host = "192.168.1.xx"; // server host
const int port = 8000;
void setup()
{
Serial.begin(9600);
require 'webrick'
require 'webrick/cgi'
require 'pp'
require 'net/http'
require 'fileutils'
require 'time'
class Locked < StandardError
end
@izumogeiger
izumogeiger / gc10-esp8266.ino
Created June 3, 2017 12:16
GeigerCounter Sensor gc10 + esp8266
#include <ESP8266WiFi.h>
#define USE_WIFI 1
const char* ssid = "wifi_ssid";
const char* password = "password";
const char* host = "192.168.1.xxx";
const int port = 8000;
/// デジタルIOのピンの設定 ///
int signPin = 16; //信号(黄)
const double alpha = 53.032; // cpm = uSv × alpha
#include <Wire.h>
// bme280
// SDA=A4 SCL=A5
#define BME280_ADDRESS 0x76
unsigned long int hum_raw,temp_raw,pres_raw;
signed long int t_fine;
double temp_act = 0.0, press_act = 0.0,hum_act=0.0;
require 'pp'
require 'fileutils'
require 'net/https'
class Locked < StandardError
end
def lock(lock_file_path='/tmp/mix1.lock')
File.open(lock_file_path, 'w') do |lock_file|
if lock_file.flock(File::LOCK_EX|File::LOCK_NB)
// DHT
#include <DHT.h>
#define DHTTYPE DHT11
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE);
// gp2y
int measurePin = 0; //Connect dust sensor to Arduino A0 pin
int measurePin = 0; //Connect dust sensor to Arduino A0 pin
int ledPower = 3; //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
#include "LedControl.h"
/* DIN CS CLK */
LedControl lc=LedControl(2,4,3,1);
unsigned long delaytime=200;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
// Ping a remote server, also uses DHCP and DNS.
// 2011-06-12 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x32,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;