Skip to content

Instantly share code, notes, and snippets.

@hbcruoma
hbcruoma / iotnode.ino
Last active March 22, 2018 13:52
Mkr1000-pohjaisen lämpötilaa, ilmankosteutta (DHT22) ja hiilidioksidipitoisuutta (MH-Z19) mittaavan, proprietary-APIa käyttävän noodin koodi
/*
* MHZ-19 wiring
*
* Connections:
* MH-Z19 MKR1000
* 2(Rx)----D14(Tx)
* 3(Tx)----D13(Rx)
* 6(Vin)---5V
* 7(GND)---GND
*/
@hbcruoma
hbcruoma / AmicaPhp.php
Created February 12, 2018 10:23
Pikku PHP-pätkä Amican ruokalistan lukemiseen.
<?php
$dayname = array("", "Ma", "Ti", "Ke", "To", "Pe", "La", "Su");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
@hbcruoma
hbcruoma / MH-Z19test.ino
Created February 8, 2018 04:49
Esimerkki MH-Z19B -anturin lukemisesta Mkr1000:lla. Perustuu lähteeseen http://www.twobears.at/wordpress/diy/co2-messung-mit-mh-z19-und-arduino/, lisätty mm. Mkr1000-kytkennät.
/* Programm zum Auslesen der CO2-Konzentration aus 2 Sensoren MH-Z19 an einem Arduino Mega
* Die Sensoren befinden sich an den seriellen Schnittstellen 1 und 2.
* Die Werte werden dann an im Klartext an den Computer übergeben.
* Geschrieben von: Norbert Huber
* Datum: 08.04.2017
*/
/*
* Serial 1 pins:
* D13 - Rx
@hbcruoma
hbcruoma / sortlist.java
Last active November 4, 2016 21:52
Järjestä oliolista oliomuuttujan arvon perusteella (int)
// sort ascending
Collections.sort(this.scores, (Score s1, Score s2) -> {
return Integer.compare(s1.getScore(), s2.getScore());
});
// reverse sort
Collections.sort(this.scores, (Score s1, Score s2) -> {
return Integer.compare(s2.getScore(), s1.getScore());
});