Arduino. Капельный полив растений.

Posted: 13th Август 2015 by shmyak in arduino

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);

#define relay 13
#define MAX_FLOWTIME 180 // seconds
#define MIN_FLOWTIME 30 // seconds
#define MAX 1022
#define MIN 5
int volumePin = A0;
long duration;
long interval = 3000;
long oldDuration;

void setup()
{
Serial.begin(9600);
pinMode(relay, OUTPUT);
lcd.init();
lcd.backlight();
}

void water() {
static bool state;
static unsigned long time;
if((millis() — time) > (state ? duration : interval))
{
state = !state;
digitalWrite(relay, state);
time = millis();
Serial.println(duration);

}
}

void lcd_print() {
lcd.setCursor(0,0);
lcd.print(duration / 1000);
}

void loop() {
duration = map(analogRead(volumePin), MIN, MAX, MIN_FLOWTIME, MAX_FLOWTIME) * 1000;
if (duration != oldDuration){
lcd.clear();
}

lcd_print();
water();
oldDuration = duration;
}

Таймер для ардуины

Posted: 13th Август 2015 by shmyak in arduino

#define relay 13
long duration = 1000;
long interval = 3000;
void setup()
{
Serial.begin(9600);
pinMode(relay, OUTPUT);
}

void loop()
{
static bool state;
static unsigned long time;
if((millis() — time) > (state ? duration : interval))
{
state = !state;
digitalWrite(relay, state);
time = millis();
}
}

xfce system hotkeys

Posted: 29th Июль 2015 by shmyak in Пингвин

~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

konsole hotkeys

~/.kde/share/config/konsolerc
~/.kde/share/apps/konsole
~/.kde/share/apps/konsole/konsoleui.rc
~/.kde/share/apps/konsole/konsole
~/.config/konsolerc

Keyboard volume buttons

xfce4-volumedAUR maps volume keys to xfce-mixer, and displays notifications through xfce4-notifyd. When using PulseAudio, use xfce4-volumed-pulseAUR instead. See also #Xfce4-mixer and pulseaudio.

If you are using PulseAudio and do not wish to use Xfce4 mixer, you could use xfce4-pulseaudio-pluginAUR instead. This package provides a mixer applet for the panel and has support for the keyboard volume keys.

For non desktop environment specific alternatives, see List of applications#Volume managers.

Netgear R8000. Recovery flash in failsafe mode

Posted: 18th Апрель 2015 by shmyak in Пингвин

If you happen to brick your router, do not fear. You can use TFTP file transfer to flash the router with a new firmware.

You need:

  • A TFTP client for your computer. There are both command-line tools and GUI versions available.
  • Your computer must have an IP address from the 192.168.1.x network, as the router failsafe mode defaults to 192.168.1.1.
  • A new firmware to flash in. Either an original Netgear firmware or an Openwrt «factory.img» firmware. «Sysupgrade» version will not work.
  • Access to router’s reset button
  1. Configure your ethernet connection (on the client machine you’re using to configure the WNDR3800) using a static IP as 192.168.1.2, netmask 255.255.255.0. (The WNDR3800 in factory reset mode is going to come up as 192.168.1.1.)
  2. Connect your computer to one of the LAN (not WAN) ports on the router.
  3. Start a continuous ping from your client computer to 192.168.1.1 (Linux and Mac OS ping will continue until stopped by default; Windows ping by default sends 4 pings and then stops, so use «ping -t» under Windows); probably nothing will answer these pings yet, but you can use the output to tell you when the router is ready in the next couple steps.
  4. Power the router off.
  5. Hold down the factory reset button on the bottom of the case. Now turn the router back on while continuing to hold the factory reset button…
  6. Wait until the router is listening on 192.168.1.1 (this takes 45-60 seconds; to confirm, you can ping 192.168.1.1, and see if it responds; it’s best to start a sequence of ping requests above, before your hands get busy with the factory reset button).
  7. Release the factory reset button. (If you happen to have a serial cable connected, you’ll see that the system is in firmware recovery mode and that it will be waiting for you to upload firmware. But you don’t need the serial cable at all.)
  8. Run a tftp CLIENT on your computer (enter no hostname on the command line), set trasfer mode to binary and retransmit timeout to one second (optional), next put firmware image to router.

For the linux tftp client enter the following (note «rexmt 1»! Some people do not see «1» and enter «binary» as the value for rexmt, thus they do not switch to the binary mode, and upload doesn’t start):

If successful, you will see upload progress info for a couple of seconds, then the router will flash itself and reboot automatically. This may take several minutes. Be patient, don’t reset or switch off a router!

 

Pin Out Description
Pin1 3.3V
Pin2 TX
Pin3 RX
Pin4 GND

 

wndr3700-serial

 

 

(:

Posted: 10th Февраль 2015 by shmyak in Юмор

image

Енотко

Posted: 21st Ноябрь 2014 by shmyak in Юмор

preview-650x390-650-1414137817

raccoon-hugs-catbanjo-and-buddy

anigif_enhanced-buzz-21257-1397149065-20

anigif_enhanced-buzz-7728-1397148685-30

h53b300e3

anigif_enhanced-buzz-26254-1397147731-15

vzwxxfj

anigif_enhanced-buzz-23642-1397147837-24

02_yapfilesru

anigif_enhanced-buzz-31679-1374080287-17

anigif_enhanced-buzz-18722-1374079813-17

hv8ziwo

tumblr_mzrvj5xqwe1s02vreo1_400

racoon-plays-the-sprinkler-harp

bekhnj1

Posted: 23rd Сентябрь 2014 by shmyak in Юмор

takov_zamysel

img_356964748_70116_1

img_356964748_70122_1

img_356964748_70131_1

img_356964748_70133_1

1984

Posted: 23rd Сентябрь 2014 by shmyak in Юмор

Свобода — это рабство!
Война — это мир!
Падение курса рубля — это рост экономики!

эволюция

Posted: 23rd Май 2014 by shmyak in Юмор

25