Skip to content

Instantly share code, notes, and snippets.

@yildak
yildak / all sensors+rgb.lua
Last active August 29, 2015 14:18
plant_pot_esp12
--plant doctor, smart pot system, esp-12 standalone wiring
--
--ds18b20 on GPIO5/pin2
--photocell on GPIO4/pin1
--soil probes on ADC/id=0
--R on GPIO13/pin7 - set low first
--G on GPIO12/pin6 - set low first
--B on GPIO14/pin5 - set low first
--
-- GPIO15 & GND on ESP to GND
#include <SoftwareSerial.h>
int sensor_temp = A2;
int value_temp;
int sensor_light = A1;
int value_light;
int sensor_water = A0;
int value_water;
int red = 9;
int green = 8;
@yildak
yildak / init.lua
Last active October 17, 2015 20:18
esp-12 standalone mode
print("Setting up WIFI...")
wifi.setmode(wifi.STATION)
--modify according your wireless router settings
wifi.sta.config("SSID","PASS")
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip()== nil then
print("IP unavaiable, Waiting...")
else