Skip to content

Instantly share code, notes, and snippets.

%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
-module(light).
-export([start/0,start/1]).
-define(TABLE, sensor).
-define(STORE, "db/sensor.db").
-define(TTY, "/dev/ttyUSB0").
-define(LDR, $1).
-define(INTRVL, 1000).
-module(sensor).
-include("light.hrl").
-export([start/0,stop/0]).
% web interface
-export([graph/3]).
start() ->
-module(health).
-behaviour(gen_server).
-export([start_link/0,
check/0, alert/0, dump/0,
threshold/1, poll/1, url/1
]).
-export([init/1, handle_call/3]).
int LDR = 2;
int val = 0;
int inb = 0;
void setup() {
Serial.begin(9600);
pinMode(LDR, INPUT);
}
void loop() {
#define DEBUG 0
#define FPIN 8 // first Pin
#define LPIN 13 // last Pin
void setup() {
int i = 0;
Serial.begin(9600);
for (i = FPIN; i <= LPIN; i++)
%%% Cause epmd to use 100% CPU
%%%
%%% ulimit -n 16
%%% epmd -d -p 1234
%%%
%%% $ erl
%%% emfile:start(1234,32).
%%%
-module(emfile).
-compile(export_all).