This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <FlexiTimer2.h> | |
constexpr auto LED_PIN ( 13 ); | |
constexpr auto NUM_BATTERIES ( 4 ); | |
constexpr auto START_VALUE ( 205 ); // 1.0v | |
constexpr auto THRESHOLD_H ( 307 ); // 1.5v | |
constexpr auto THRESHOLD_L ( 205 ); // 1.0v | |
constexpr auto ALMOST_ZERO ( 21 ); // 0.1v | |
//平滑化する関数オブエクト。Batteryのメンバ関数として使う。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WARNING: This a "legacy example based on a deprecated library". Check filters.lib | |
// for more accurate examples of filter functions | |
declare name "APFDelay"; | |
import("maxmsp.lib"); | |
APFSt(F,Q) = APF(_,F,0,Q),APF(_,F,0,Q); | |
process = APFSt(250,1.5):APFSt(700,4.5):APFSt(1250,6.3):APFSt(1600,15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr int NUM_BUTTONS ( 4 ); | |
constexpr int LED_PIN ( 13 ); | |
constexpr int GND_PINS[ NUM_BUTTONS ] { 5, 7, 9, 11 }; | |
class Debounce{ | |
static constexpr long RATE = 12; | |
static constexpr long THRESHOLD_L = 10; | |
static constexpr long THRESHOLD_H = 90; | |
long innerMul100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr int NUM_BUTTONS ( 4 ); //buttonの数 | |
constexpr int LED_PIN ( 13 ); // LEDのピン | |
constexpr int GND_PINS[ NUM_BUTTONS ] { 5, 7, 9, 11 }; //結線の都合でGNDとして使用 | |
// Button構造体の定義 | |
struct Button{ | |
const int PIN; | |
const int CC_NUM; | |
long innerMul100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); | |
constexpr auto KEYS ( A0 ); // キースイッチは A0に結線されている | |
// KEYの値。別途実測したもの。 | |
constexpr auto NO_KEY ( 1022 ); | |
constexpr auto SELECT_KEY ( 731 ); | |
constexpr auto LEFT_KEY ( 510 ); | |
constexpr auto DOWN_KEY ( 340 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <MIDIUSB.h> | |
#include <DebFuncs.h> | |
const int LEDPIN = 13; | |
const int INPIN[] = {3,4,5,6}; | |
const int CC_NUM[] = {25,26,27,28}; | |
DF::Debounce debounce[4]; | |
DF::IsDROPPED isDropped[4]; | |
DF::IsRAISED isRaised[4]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <DebFuncs.h> | |
// Instantiate a set of function objects. | |
DF::Debounce debounceOne; | |
// or debounceOne(10),for example. | |
// You can set reaction rate from 0(no reaction) up to 100(no debouncing). | |
// The default value is 25. | |
DF::IsDROPPED isDroppedOne; | |
// Instantiate a set of arrays. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RoomVal ( | |
RoomVal(..) | |
, initPossibles | |
, calcRmVal | |
, fixRmVal | |
, addHistStay | |
, addHistChange | |
, addVal | |
) where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyFunc ( | |
scanwl | |
, minimumF | |
) where | |
minimumF :: Ord b => (a -> b) -> [a] -> a | |
minimumF f [x] = x | |
minimumF f (x:y:xs) | |
| f x < f y = minimumF f (x:xs) | |
| otherwise = minimumF f (y:xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RoomVal | |
import MyFunc | |
planRoom :: [Int] -> Int -> [(Int,Int)] | |
planRoom grpsList rmsNum = | |
reverse . rmHist . last . | |
foldl fixeds | |
(initRmVals $ head $ validGrpss grpsList rmsNum) | |
$ tail $ validGrpss grpsList rmsNum |
NewerOlder